You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2004/08/17 01:31:59 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine Turbine.java

henning     2004/08/16 16:31:59

  Modified:    xdocs    Tag: TURBINE_2_3_BRANCH changes.xml
               xdocs/services Tag: TURBINE_2_3_BRANCH logging-service.xml
               src/java/org/apache/turbine Tag: TURBINE_2_3_BRANCH
                        Turbine.java
  Log:
  Remove explicit configuration of the commons-logging subsystem.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.60.2.17 +7 -0      jakarta-turbine-2/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
  retrieving revision 1.60.2.16
  retrieving revision 1.60.2.17
  diff -u -r1.60.2.16 -r1.60.2.17
  --- changes.xml	16 Aug 2004 22:57:47 -0000	1.60.2.16
  +++ changes.xml	16 Aug 2004 23:31:59 -0000	1.60.2.17
  @@ -82,6 +82,13 @@
   <subsection name="Changes that could break older environments">
   <p>
     <ul>
  +    <li>Turbine no longer configures the logging factory for
  +        commons-logging explicitly.  If you relied on this behaviour,
  +        you must add a commons-logging.properties file to your
  +        application as described in the <a
  +        href=http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/package-summary.html">commons
  +        logging documentation</a>
  +    </li>
       <li>commons-configuration was upgraded to 1.0-rc1. All getVector() method calls on the
           Configuration interface must be replaced with getList().
       </li>
  
  
  
  No                   revision
  No                   revision
  1.2.2.3   +20 -2     jakarta-turbine-2/xdocs/services/logging-service.xml
  
  Index: logging-service.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/services/logging-service.xml,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- logging-service.xml	20 May 2004 03:34:25 -0000	1.2.2.2
  +++ logging-service.xml	16 Aug 2004 23:31:59 -0000	1.2.2.3
  @@ -51,7 +51,25 @@
   #
   # -------------------------------------------------------------------
   
  -log4j.file = /WEB-INF/conf/Log4j.properties
  +# Configure log4j from the log4j properties file
  +log4j.file = WEB-INF/conf/Log4j.properties
  +]]></source>
  +
  +<p>
  +If you use another logging system band don't want to configure
  +the log4j subsystem, you can use the empty string or &quot;none&quot; as
  +<code>log4j.file</code> parameter to turn it off.
  +</p>
  +
  +<source><![CDATA[
  +# -------------------------------------------------------------------
  +#
  +#  L O G 4 J - L O G G I N G
  +#
  +# -------------------------------------------------------------------
  +
  +# Do not configure Log4J logging.
  +log4j.file = none
   ]]></source>
   
   </section>
  
  
  
  No                   revision
  No                   revision
  1.45.2.3  +22 -29    jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java
  
  Index: Turbine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java,v
  retrieving revision 1.45.2.2
  retrieving revision 1.45.2.3
  diff -u -r1.45.2.2 -r1.45.2.3
  --- Turbine.java	20 May 2004 03:03:54 -0000	1.45.2.2
  +++ Turbine.java	16 Aug 2004 23:31:59 -0000	1.45.2.3
  @@ -39,7 +39,6 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.commons.logging.impl.Log4jFactory;
   
   import org.apache.log4j.PropertyConfigurator;
   
  @@ -225,12 +224,6 @@
       private void configure(ServletConfig config, ServletContext context)
               throws Exception
       {
  -        //
  -        // Set up Commons Logging to use the Log4J Logging
  -        //
  -        System.getProperties().setProperty(LogFactory.class.getName(),
  -                                           Log4jFactory.class.getName());
  -
           // Set the application root. This defaults to the webapp
           // context if not otherwise set. This is to allow 2.1 apps
           // to be developed from CVS. This feature will carry over
  @@ -321,30 +314,30 @@
           String log4jFile = configuration.getString(LOG4J_CONFIG_FILE,
                                                      LOG4J_CONFIG_FILE_DEFAULT);
   
  -        log4jFile = getRealPath(log4jFile);
  -
  -        //
  -        // Load the config file above into a Properties object and
  -        // fix up the Application root
  -        //
  -        Properties p = new Properties();
  -        try
  +        if (StringUtils.isNotEmpty(log4jFile) &&
  +                !log4jFile.equalsIgnoreCase("none"))
           {
  -            p.load(new FileInputStream(log4jFile));
  -            p.setProperty(APPLICATION_ROOT_KEY, getApplicationRoot());
  -            PropertyConfigurator.configure(p);
  +            log4jFile = getRealPath(log4jFile);
   
               //
  -            // Rebuild our log object with a configured commons-logging
  -            log = LogFactory.getLog(this.getClass());
  -
  -            log.info("Configured log4j from " + log4jFile);
  -        }
  -        catch (FileNotFoundException fnf)
  -        {
  -            System.err.println("Could not open Log4J configuration file "
  -                               + log4jFile + ": ");
  -            fnf.printStackTrace();
  +            // Load the config file above into a Properties object and
  +            // fix up the Application root
  +            //
  +            Properties p = new Properties();
  +            try
  +            {
  +                p.load(new FileInputStream(log4jFile));
  +                p.setProperty(APPLICATION_ROOT_KEY, getApplicationRoot());
  +                PropertyConfigurator.configure(p);
  +            
  +                log.info("Configured log4j from " + log4jFile);
  +            }
  +            catch (FileNotFoundException fnf)
  +            {
  +                System.err.println("Could not open Log4J configuration file "
  +                        + log4jFile + ": ");
  +                fnf.printStackTrace();
  +            }
           }
   
           // Now report our successful configuration to the world
  
  
  

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