Monday, March 3, 2014

JCO trace

SAP JCo offers two different ways to write trace files.
    1. Set the two options -Djco.trace_level= -Djco.trace_path= when you start the JVM.
    2. Call the methods JCO.setTracePath(String directory_of_trace_files) and JCO.setTraceLevel(int trace_level) in your Java program.

In both cases files of signature JCO*.trc are created in the defined directory directory_of_trace_file. The quantity of log information can be adjusted with the trace level. The additional logging that is switched on for certain trace levels is described below. For error diagnostic the trace level 5 is recommended.
  • 0: no trace files are written
  • 1: logging of the SAP JCo Java API is switched on
  • 3: logging of the SAP JCo JNI API is switched on
  • 5: important information for error diagnostic is switched on

Tuesday, December 17, 2013

search muiltiple word from a file and return the result

there is a case that I need search the bigger application log and only list the logs from 2 or 3 specific classes.
i use grep to get the result.

here is the syntax

grep -r "SapPaymentDataAccessor1\|SapFiPaymentSOAPImpl1\|PaymentClrProcess" *.*

Monday, December 2, 2013

Node code for Ternary and minus combined

saw a very simple solution for learnyounode as following

//console.log(process.argv);
var total = 0;
process.argv.forEach(function(item){
        total += +item ? + item: 0;
});
console.log(total);

this is used to print out summary of command parameters
 fouth line need to be explained
+item is the a minus operation on variable "item" value(not item itself),try to convert item value(String) to a number,if the result is a number,then the ternary operator will be true,since item might be a string,we also use +item to convert item value into a number if it is a string when ternary operator returns true.



Wednesday, August 28, 2013

find out the stack trace at any point

sometimes,code call embeded too complex,we want know what is the call stack from a point of code.
we can do it like this

logger.debug(stackTraceToString(Thread.currentThread().getStackTrace()));

public String stackTraceToString(StackTraceElement[] ste){
   StringBuilder sb = new StringBuilder();
   for (StackTraceElement element : ste) {
       sb.append(element.toString());
       sb.append("\n");
   }
   return sb.toString();

}



Tuesday, August 27, 2013

find who is log in in linux server

1) pinky command will show ips that user lo in from(actually name already there)
Login    Name                 TTY      Idle   When             Where
sprathaban fisrname lastname    pts/1    17:34  2013-08-26 13:27 10.136.xx.xxx
2)windows
nbtstat -A 10.136.xxx.xxx


Local Area Connection:
Node IpAddress: [10.136.xxx.xxx] Scope Id: []

           NetBIOS Remote Machine Name Table

       Name               Type         Status
    ---------------------------------------------
    GCHELLIAH-DT   00  UNIQUE      Registered

    MAC Address = 00-1E-0B-xx-xx-xx