Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-60

when use the common-logging.properties, the system can find the common-logging.properties, but aslo use the default "Poor Man Logging"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.3
    • 1.0.x CVS, 1.1 CVS
    • None
    • None
    • windows 2000
      jdk 1.4.2_08
      tomcat 5.0.18

    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)

      { // 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?

      Attachments

        Activity

          People

            tomdz Thomas Dudziak
            tangyanjun Tang Yanjun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: