Logging Messages

For debugging and informational purposes you can log the messages to the system console.

To define and use logging:

  1. Define and initialize the org.apache.log4j. Logger class as follows:

    Logger log = Logger.getLogger(YourClass.class);

  2. Include messages as follows:

    Informational Messages

    log.info(" Your informational message goes here ");

    Debugging Messages

    Debugging Mode must be enabled.

    log.debug(" Your debug message goes here ");

    For error messages

    log.error(" Your error message goes here ", exceptionVariable);