Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: converted to 1.6 markup

...

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

Wiki MarkupAt 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 \[http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/LogFactory.html LogFactory\] buried three deep in the API docs.

In Turbine 2.3 we have used

No Format
//
// Set up Commons Logging to use the Log4J Logging
//
System.getProperties().setProperty(LogFactory.class.getName(),
                                   Log4jFactory.class.getName());

...

to set up the \[http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/LogFactory .html LogFactory \] class which is not exactly the most elegant thing to do.

Wiki MarkupIf you know, where to look, you will find a page in the docs which describes the configuration process in detail. \[http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/package-summary. html Look here.\]

Wiki MarkupPlease note, that you must still configure the underlying logging layer. So configuring commons-logging does not give you automatically a fully configured \[http://logging.apache.org/log4j/docs/ Log4J \] Logger.

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

...

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

Wiki Markup\[http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/impl/SimpleLog.html SimpleLog\] can even be configured by a properties file called _simplelog.properties_ on your class path. Wiki Markup

Also see \[http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/impl/Log4JLogger.html Log4JLogger\]