Package com.onenetwork.platform.tools.log

Extensions of log4j used for logging in Platform.

To acquire a logger, you should add a line similar to the following to your class:

private static PlatformLogger LOG = PlatformLogger.get(MyClass.class);

Logging is done by calling a method with the appropriate priority name. For example:

LOG.info("Something interesting happened");
LOG.debug("Here are some details for debugging purposes");

try {
 ...
}
catch (Exception e) {
  LOG.warn("Caught exception e but handled it gracefully", e);
  ...
}
 

The priority of log levels within Platform is as follows:

  • FATAL
  • ERROR
  • WARN
  • INFO (this is the default log level in for a running server)
  • DEBUG_SQL
  • DEBUG
  • DEBUG_MEDIUM
  • DEBUG_DETAILED

Logging can be configured on the fly through the JMX console. Visit http://localhost/jmx-console and choose the Logger=OneNetwork Logger Service service. Using the setDebugLevel() method, you can provide the name of a logger and a priority to change the logged level for that logger.

In installed Platform instances, logs are typically written to the plt_work/logs directory by default, and are named by date.