IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to write server log in Java service

  • 1.  How to write server log in Java service

    Posted Wed December 14, 2016 02:43 AM

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


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: How to write server log in Java service

    Posted Wed December 14, 2016 03:09 AM
    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...");

    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: How to write server log in Java service

    Posted Wed December 14, 2016 11:38 AM

    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) {}

    #webMethods
    #Integration-Server-and-ESB