WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

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

Which's the best practice if I want to log application messages running on WAS?

  • 1.  Which's the best practice if I want to log application messages running on WAS?

    Posted Tue January 31, 2012 10:09 PM

    Hi pals,
    Which's the best practice if I want to log application messages running on WAS?
    I guess isn't write directly in SystemOut file, right?. I think SystemOut.log must be left for server messages only. Based in your experiences, what way would you recommend?

    I read the info center "Adding logging and tracing to your application" but I really did not understand..... :S


    Thanks all.



  • 2.  Which's the best practice if I want to log application messages running on WAS?

    Posted Wed February 01, 2012 06:37 PM
    Broad question.. here are few methods:


    1. websphere provides an options using Jakartha commons logging [which you might have read under configuring logging and tracing section]. By default, the product uses the Jakarta Commons Logging LogFactory implementation and JDK14Logger, which were specified in commons-logging.properties file. you can use the same logging option for application as well. In such case you need to have its own logger configuration [commons-logging]

    2. You can also use CBE model [common base events]. 

    3. This link discuss in detail about how to use java logging

    4. ..and everyone knows log4j.


     


  • 3.  Which's the best practice if I want to log application messages running on WAS?

    Posted Thu February 09, 2012 06:03 AM
    "I guess isn't write directly in SystemOut file, right?. "
    I just want to warn you about this common mistake many developers do. System.out.println() in java is simple to write, but it is a "break" for the program. The reason for that: System.out.println() works synchronously! Your program waits until the message is written to the console. The logging frameworks already mentioned work asynchronously, you send the message and don't have to wait. It's also a performance topic, not only a design issue.
    Regards,
    Rodney