JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides  |  Tools
Overview
Support
Development
JPOX Design : Logging

Java Persistent Objects (JPOX) utilises the popular Log4J logging library by default. Moreover, JPOX allows you to log messages to various categories, allowing users to filter the logged messages by these categories.

org.jpox.util.JPOXLogger

The JPOXLogger class provides the central registry of logging categories used by JPOX. It provides an accessor for retrieving a particular logging category -- used as follows

JPOXLogger.METADATA.info("my log message");

There are the various categories defined in the JPOXLogger class (depends on the version of JPOX). Only add new ones after discussion with other developers

Logging messages

Log4J allows you to log messages at various severity levels. These are DEBUG, INFO, WARN, ERROR, FATAL. Each message is logged at a particular level to a category (as described above).

To log a message is very simple. See below for a few examples

    JPOXLogger.RDBMS_SCHEMA.info("my log message");
    JPOXLogger.RDBMS_SCHEMA.error("my log message");
    if (JPOXLogger.RDBMS_SCHEMA.isDebugEnabled())
    {
        JPOXLogger.RDBMS_SCHEMA.debug("my log message at debug level");
    }

Please refer to Log4J Manual for details of what you can do with a Log4J Logger To see how you can use the logging from a users perspective, refer to the User Logging Guide for JPOX 1.1, or JPOX 1.2.

Using other logging mechanisms

JPOX in 1.0 and 1.1 (upto 1.1.1) only allowed logging using Log4J. From JPOX 1.1.2 onwards there are 3 "implementations" of JPOXLogger that provide logging with either Log4J, JDK1.4 logging, or no logging. If other logging systems come along then we can easily provide a new implementation of JPOXLogger to support that system