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

Logging service implementation using log4j2 - Logs not getting printed

  • 1.  Logging service implementation using log4j2 - Logs not getting printed

    Posted Fri October 19, 2018 04:12 AM

    I was trying to implement custom logging using Java services and log4j2 jars (as provided by Apache), however I am stuck with the logs not getting printed into my logger as defined.

    I read through Blogs such as below - to obtain certain assistance with these and also read the Apache log setup guide:
    http://techcommunity.softwareag.com/pwiki/-/wiki/Main/Good+To+Know+-+Custom+logging

    Apache Log configuration:
    http://logging.apache.org/log4j/2.x/manual/configuration.html

    Based on these guidelines:

    1. I place both the required JARs (log4j-API-2.11.1, log4j-core-2.11.1) at locaton- “…\packages\LoggingFrameHimanshu\code\jars”
    2. Placed the log4j2.xml at the location - “…\packages\LoggingFrameHimanshu\code\classes\LoggingFrameHimanshu”, with reference to looger file to print in as placed in project folder only i.e. “…\packages\LoggingFrameHimanshu\resources\myLogger.log”
    3. Hence setup a Java flow service in the project to print logs to this - see attached.

    However, when I am trying to run the service standalone - passing the parameters as input - the logger will not have logs printed.

    Please assist experts. This should be pretty common task on day to day basis - not sure what is being missed here.
    LoggingFrameHimanshu.zip (1.59 MB)


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


  • 2.  RE: Logging service implementation using log4j2 - Logs not getting printed

    Posted Mon October 22, 2018 10:34 PM

    Bump … Anyone, assistance much appreciated.


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


  • 3.  RE: Logging service implementation using log4j2 - Logs not getting printed

    Posted Tue October 23, 2018 01:57 AM

    are you loading log4j properties xml in memory?
    i vaguely remember implementing this… you don’t need to have separate log4j jar file, IS already has log4j in its classpath. in my code i had to create a start up service which would load log4j2.xml file in memory and then in my code i would make use of logger define in property file to log.


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


  • 4.  RE: Logging service implementation using log4j2 - Logs not getting printed

    Posted Tue October 23, 2018 04:37 AM

    What is the version of webMethods ? Also are you trying to use slf4j or log4j? It gets confusing with both of these - see logging - LoggerFactory vs Logger - Stack Overflow


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


  • 5.  RE: Logging service implementation using log4j2 - Logs not getting printed

    Posted Wed October 24, 2018 05:22 AM

    That makes sense and sound to be the missing piece her. Let me give it a try a get back on this.

    I am using log4j v2.0.


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