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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
Expand all | Collapse all

Java service outPut

  • 1.  Java service outPut

    Posted 03/27/14 07:04 AM

    Hello All,

    When we are making any java service in designer.Where does out put for System.out.println get printed.Not getting this values either in console or any server/error log.
    What syntex do we need to apply to write server log or error Log.

    Please provide your feedback.

    Thanks
    Baharul


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Java service outPut

    Posted 03/27/14 07:51 AM

    Hi,

    I used below code to write to server.log on developer wM 7.1.2. Hope the same works on designer.

    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO,
    com.wm.util.JournalLogger.FAC_FLOW_SVC,
    com.wm.util.JournalLogger.DEBUG,
    “DEBUG TEXT HERE!” );

    You may wish to wrap this up in a service for convenience and put it in the shared section of your code (or in a utility class):

    public static void debugLog(String text)
    {

    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO,
    com.wm.util.JournalLogger.FAC_FLOW_SVC,
    com.wm.util.JournalLogger.DEBUG,
    text );
    }
    Then in your code you can simply call:

    debugLog(“hello there”);

    For wM 8.2

    Have a look at the below link


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: Java service outPut

    Posted 03/27/14 07:52 AM

    Are you running the IS on Windows or Unix?
    If on Windows, is IS running as a Service or as an Application?

    For a Service on Windows there will be no such Output.

    For an Application on Windows as well as for Unix there is output availabler either to a Command Prompt Window on Windows or in the nohup.out on Unix.

    To write to server log you have to use the service pub.flow:debugLog, which can be called from java services too.

    See Build-In Services Guide and Java Service Developers Guide for further information.

    Regards,
    Holger


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: Java service outPut

    Posted 03/27/14 09:04 AM

    Thanks Mahesh & Holger.
    Currenly using wm version is 9.0 and runnins as Service in windows System.
    So there will be no console output for System.out command.

    @Mahesh,
    I have tried with JournalLogger but this was not working for me.Will again try and let you know the result.

    Thanks
    Baharul


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 5.  RE: Java service outPut

    Posted 04/02/14 07:58 AM

    Please try:

    
    JournalLogger.log(4, JournalLogger.FAC_FLOW_SVC, JournalLogger.DEBUG,"function", "message");

    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: Java service outPut

    Posted 04/05/14 04:07 PM

    @Baharul,

    println sends output to console. In case of unix, you see in nohup.out. In windows if server started as application, you can view the println in console output. If IS is running as service on windows there is no way[ as far as I know].

    I suggest write a small code in Source:

    public static void logger (String message) {
    
    IData input = IDataFactory.create();
    IDataCursor inputCursor = input.getCursor();
    IDataUtil.put( inputCursor, "message", message );
    IDataUtil.put( inputCursor, "function", "customLogger" );
    IDataUtil.put( inputCursor, "level", "INFO" );
    inputCursor.destroy();
    
    IData 	output = IDataFactory.create();
    try{
    output = Service.doInvoke( "pub.flow", "debugLog", input );
    }catch( Exception e){}
    }

    and use logger(“log Message”); in your java code

    everytime you need to send something in serverlog/debug data.

    BTW JournalLogger is nothing but just a different representation of debugLog.

    HTH.

    Thanks,
    Rankesh


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 7.  RE: Java service outPut

    Posted 04/08/14 11:05 AM

    Thanks Rankesh.
    This JournalLogger or custom code to invoke DebugLog service is working.

    Thanks
    Baharul


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: Java service outPut

    Posted 04/11/14 12:28 PM

    If you’re using the System.out.println() function, it may be in the “wrapper.log”.

    Should be here :
    \profiles\IS\logs\wrapper.log


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: Java service outPut

    Posted 10/29/19 03:25 PM

    Rankesh,
    I know this is an Old post, but was still pretty effective - while I was trying to debug a Java service invoking an External AMZ Client libray services. Thanks.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 10.  RE: Java service outPut

    Posted 10/30/19 05:58 AM

    As Arnaud mentioned .

    System.out.println() function is written on to the wrapper.log file

    \profiles\IS\logs\wrapper.log


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 11.  RE: Java service outPut

    Posted 10/30/19 08:52 AM

    Hi,

    additionally there is the option to redirect the standard output to nohup.out, esp. on Unix systems.

    Regards,
    Holger


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB