csli.util.logging
Class LoggingUtils

java.lang.Object
  extended by csli.util.logging.LoggingUtils

public class LoggingUtils
extends Object

A basic interface to Log4J for simple uses.

First, configure the logging by passing a config file into the configuration method (see log4j docs for more info). Then, in your class, use the following code to get a logger. In this example, there would be one logger per class, which is a nice way of doing it but not required. You can name the logger however you want.

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

Then you can log things one of the following loggin methods:

The configuration process can be complex, and I leave documentation up to the log4j docs, but at the very least, the following properties, put in the config file you pass in, will format the logs in a useful way and send them to STDOUT.

Author:
John Niekrasz

Constructor Summary
LoggingUtils()
           
 
Method Summary
static void configureLog4J()
          This will configure Log4J based on the properties set in the specified config file - note that this should really only be called from main methods when processes are started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingUtils

public LoggingUtils()
Method Detail

configureLog4J

public static void configureLog4J()
This will configure Log4J based on the properties set in the specified config file - note that this should really only be called from main methods when processes are started. OAA does not follow this rule and sets the configuration when the library is loaded, so if you use OAA, you will need to call this again after the OAA library is loaded. Lame!