Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2012-07-02T09:38:43Z by SystemAdmin
LindaR
LindaR
47 Posts
ACCEPTED ANSWER

Pinned topic com.ibm.websphere.batch.BatchLogger logging methods

‏2008-06-02T12:29:26Z |
In the processJobStep I've used both the BatchLogger log() method and the logToFile() method. Both the message logged to ${USER_INSTALL_ROOT}/joblogs/JobName_JobID/timestamp/part.1.log.

What then is the difference between these to methods?
Updated on 2012-07-02T09:38:43Z at 2012-07-02T09:38:43Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    783 Posts
    ACCEPTED ANSWER

    Re: com.ibm.websphere.batch.BatchLogger logging methods

    ‏2008-06-03T20:29:05Z  in response to LindaR
    OK, we have made an error. BatchLogger is intended to be a private interface. It should not be in the documentation and it should not be in package name, com.ibm.websphere. It should have been com.ibm.ws, which is our convention for private interface. We'll figure out how we let this one get out of the lab.

    Meanwhile ...

    The job log support is designed to capture all output written to the standard output and error streams by your application. So you can use System.out and System.err, respectively. Rather than using the standard streams directly, a good practice is to use log4j and its standard ConsoleAppender. Using log4j provides a good approach for controlling logging levels and layout.



  • SystemAdmin
    SystemAdmin
    783 Posts
    ACCEPTED ANSWER

    Re: com.ibm.websphere.batch.BatchLogger logging methods

    ‏2008-06-03T20:40:13Z  in response to LindaR
    Well, ok, I didn't actually answer your question:

    BatchLogger.logToFile() writes to the joblog. BatchLogger.log() writes to joblog and also sends a copy of the output line to the job scheduler. The latter exists to provide backward compatibility with Compute Grid v6.0, where container messages were logged in the scheduler's database. Only v6.0 container messages are handled that way. Those messages and all those added starting in v6.1 are logged in the joblog.

    The best reason to not use the BatchLogger class in your application is because:

    1. log4j is much better
    2. BatchLogger is not portable

      It does not work in the BatchSimulator environment.







    • SystemAdmin
      SystemAdmin
      783 Posts
      ACCEPTED ANSWER

      Re: com.ibm.websphere.batch.BatchLogger logging methods

      ‏2012-07-02T09:38:43Z  in response to SystemAdmin
      so we can use log4j withe compute grid v6.1 ?

      email:s.daouiji@gmail.com