db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tang Yanjun (JIRA)" <j...@apache.org>
Subject [jira] Created: (OJB-60) when use the common-logging.properties, the system can find the common-logging.properties, but aslo use the default "Poor Man Logging"
Date Fri, 15 Jul 2005 06:26:28 GMT
when use the common-logging.properties, the system can find the common-logging.properties,
but aslo use the default "Poor Man Logging"
--------------------------------------------------------------------------------------------------------------------------------------

         Key: OJB-60
         URL: http://issues.apache.org/jira/browse/OJB-60
     Project: OJB
        Type: Bug
    Versions: 1.0.3    
 Environment: windows 2000
jdk 1.4.2_08
tomcat 5.0.18
    Reporter: Tang Yanjun


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)
                        {
                            // yep, so use commons-logging
                            _loggerClass      = CommonsLoggerImpl.class;
                            _loggerConfigFile = "commons-logging.properties";
                            bootLogger.info("Logging: Found 'commons-logging.properties' file,
use " + _loggerClass);
                            ojbLogPropFile.close();
                        }
                    }
                    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)
                        {
                            // yep, so use commons-logging
                            _loggerClass      = CommonsLoggerImpl.class;
                            _loggerConfigFile = "commons-logging.properties";
                            bootLogger.info("Logging: Found 'commons-logging.properties' file,
use " + _loggerClass);
                            ojbLogPropFile.close();
                        }
                    }
                    catch (Exception ex)
                    {}
               }
               if (_loggerClass == null){
                    // no, so default to poor man's logging
                   bootLogger.info("** Can't find logging configuration file, use default
logger **");
                    _loggerClass = PoorMansLoggerImpl.class;
               }

right?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message