How to Configure the Logging Factory and the Logging Class

One of the questions that popped up on the Turbine mailing list is, why there is no file for Turbine.

At this point I started wondering, whether one could use this to actually configure logging for Turbine applications . I looked at the docs and found the docs on how to configure the LogFactory buried three deep in the API docs.

In Turbine 2.3 we have used

// Set up Commons Logging to use the Log4J Logging

to set up the LogFactory class which is not exactly the most elegant thing to do.

If you know, where to look, you will find a page in the docs which describes the configuration process in detail. Look here.

Please note, that you must still configure the underlying logging layer. So configuring commons-logging does not give you automatically a fully configured Log4J Logger.

For a small application without many logging needs, I'd recommend to use the method. Put a file called in your class path with the following contents:

org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog

This will use the default Factory class implementation and use the integrated simple Logger to send logging output to stderr.

SimpleLog can even be configured by a properties file called on your class path.

Also see Log4JLogger

How_to_Configure_the_Logging_Factory_and_the_Logging_Class (last edited 2009-09-20 23:48:32 by localhost)