How to write server log in Java service

Usually, server log could be writen thru flow service pub.flow.debugLog in Webmethod. However, how to write server log in Java service?

import com.wm.util.JournalLogger;

JournalLogger.log(CODE,FACILITY,SEVERITY,LOG_PREFIX, LOG_MESSAGE);

CODE = 4 (for custom logging)

FACILITY = 90 (for custom logging)

SEVERITY:
CRITICAL = 0;
ERROR = 1;
WARNING = 2;
INFO = 3;
DEBUG = 4;

 Example: JournalLogger.log(4,90,4,"[MY.APP.LOG]", "Something happened...");
2 Likes

In addition to this, there is also another way of doing it

// input IData input = IDataFactory.create(); 
IDataCursor inputCursor = input.getCursor(); 
IDataUtil.put( inputCursor, "message", "message" ); 
IDataUtil.put( inputCursor, "function", "function" ); 
IDataUtil.put( inputCursor, "level", "level" ); 
inputCursor.destroy();

// output IData output = IDataFactory.create(); 
try 
{ 
    output = Service.doInvoke( "pub.flow", "debugLog", input ); 
} 
catch( Exception e) {}
1 Like