Details
Description
Just put "commons-logging.properties" under the WEB-INF/classes. no "OJB-logging.properties"
The Ojb BOOT log will output:
[BOOT] DEBUG: Instantiate PersistenceBrokerFactory
[BOOT] INFO: Loading OJB's properties from file file:/F:/My%20WorkSpace/Apache/Tomcat-5.0.18/webapps/empty/WEB-INF/classes/OJB.properties
[BOOT] DEBUG: No value for key "ObjectCacheClass", using default org.apache.ojb.broker.cache.ObjectCacheDefaultImpl.
[BOOT] INFO: Logging: Found 'commons-logging.properties' file, use class org.apache.ojb.broker.util.logging.CommonsLoggerImpl
[BOOT] INFO: ** Can't find logging configuration file, use default logger **
This mean the Obj can find the "commons-logging.properties", but it doesn't use it, it also use the "Poor Mans Logging".
I see the source code for class "org.apache.ojb.broker.util.logging.LoggingConfiguration" and I find the problem:
if (_loggerClass == null)
{
// or a commons-logging.properties file ?
try
{
ojbLogPropFile = contextLoader.getResourceAsStream("commons-logging.properties");
if (ojbLogPropFile != null)
}
catch (Exception ex)
{}
// no, so default to poor man's logging
----->>> bootLogger.info("** Can't find logging configuration file, use default logger **");
----->>> _loggerClass = PoorMansLoggerImpl.class;
}
I think the right code should be:
if (_loggerClass == null)
{
// or a commons-logging.properties file ?
try
{
ojbLogPropFile = contextLoader.getResourceAsStream("commons-logging.properties");
if (ojbLogPropFile != null)
}
catch (Exception ex)
{}
}
if (_loggerClass == null)
right?