commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging/impl Log4JCategoryLog.java Log4JLogger.java
Date Wed, 02 Apr 2003 01:29:40 GMT
craigmcc    2003/04/01 17:29:39

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        Log4JCategoryLog.java Log4JLogger.java
  Log:
  Remove attempt to configure the root logger if it has not been done so.
  
  * Out of scope for commons-logging, which promises only to wrap
    USE of the logging implementation, not configuration.
  
  * Incorrect assumption that not having appenders configured on the
    root logger is an error.
  
  * Log4J will auto-configure itself if a log4j.xml or log4j.properties
    file is present, so out-of-the-box use with no code is as simple
    as dropping a properties file in the correct place.
  
  PR:  Bugzilla #13201
  Submitted by: Steven Caswell <stevencaswell at apache.org>
  
  Revision  Changes    Path
  1.10      +4 -32     jakarta-commons/logging/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java
  
  Index: Log4JCategoryLog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Log4JCategoryLog.java	30 Mar 2003 23:42:36 -0000	1.9
  +++ Log4JCategoryLog.java	2 Apr 2003 01:29:38 -0000	1.10
  @@ -87,9 +87,6 @@
       /** The fully qualified name of the Log4JCategoryLog class. */
       private static final String FQCN = Log4JCategoryLog.class.getName();
       
  -    private static boolean initialized=false;
  -    private static String LAYOUT="%r [%t] %p %c{2} %x - %m%n";
  -
       /** Log to this category */
       private Category category = null;
   
  @@ -97,9 +94,6 @@
       // ------------------------------------------------------------ Constructor
   
       public Log4JCategoryLog() {
  -        if( ! initialized ) {
  -            initialize();
  -        }
       }
   
   
  @@ -107,40 +101,18 @@
        * Base constructor
        */
       public Log4JCategoryLog(String name) {
  -        if( ! initialized ) {
  -            initialize();
  -        }
           this.category=Category.getInstance(name);
       }
   
       /** For use with a log4j factory
        */
       public Log4JCategoryLog(Category category ) {
  -        if( ! initialized ) {
  -            initialize();
  -        }
           this.category=category;
       }
   
   
       // ---------------------------------------------------------- Implmentation
   
  -    private void initialize() {
  -        Category root=Category.getRoot();
  -        Enumeration appenders=root.getAllAppenders();
  -        if( appenders==null || ! appenders.hasMoreElements() ) {
  -            // No config, set some defaults ( consistent with
  -            // commons-logging patterns ).
  -            ConsoleAppender app=new ConsoleAppender(new PatternLayout( LAYOUT ),
  -                                                    ConsoleAppender.SYSTEM_ERR );
  -            app.setName("commons-logging");
  -            
  -            root.addAppender( app );
  -            root.setPriority( Priority.INFO );
  -        }
  -        initialized=true;
  -    }
  -    
   
       /**
        * Log a message to the Log4j Category with <code>TRACE</code> priority.
  
  
  
  1.3       +4 -32     jakarta-commons/logging/src/java/org/apache/commons/logging/impl/Log4JLogger.java
  
  Index: Log4JLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/Log4JLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Log4JLogger.java	30 Mar 2003 23:42:36 -0000	1.2
  +++ Log4JLogger.java	2 Apr 2003 01:29:38 -0000	1.3
  @@ -85,9 +85,6 @@
       /** The fully qualified name of the Log4JLogger class. */
       private static final String FQCN = Log4JLogger.class.getName();
       
  -    private static boolean initialized=false;
  -    private static String LAYOUT="%r [%t] %p %c{2} %x - %m%n";
  -
       /** Log to this logger */
       private Logger logger = null;
   
  @@ -95,9 +92,6 @@
       // ------------------------------------------------------------ Constructor
   
       public Log4JLogger() {
  -        if( ! initialized ) {
  -            initialize();
  -        }
       }
   
   
  @@ -105,40 +99,18 @@
        * Base constructor
        */
       public Log4JLogger(String name) {
  -        if( ! initialized ) {
  -            initialize();
  -        }
           this.logger=Logger.getLogger(name);
       }
   
       /** For use with a log4j factory
        */
       public Log4JLogger(Logger logger ) {
  -        if( ! initialized ) {
  -            initialize();
  -        }
           this.logger=logger;
       }
   
   
       // ---------------------------------------------------------- Implmentation
   
  -    private void initialize() {
  -        Logger root=Logger.getRootLogger();
  -        Enumeration appenders=root.getAllAppenders();
  -        if( appenders==null || ! appenders.hasMoreElements() ) {
  -            // No config, set some defaults ( consistent with
  -            // commons-logging patterns ).
  -            ConsoleAppender app=new ConsoleAppender(new PatternLayout( LAYOUT ),
  -                                                    ConsoleAppender.SYSTEM_ERR );
  -            app.setName("commons-logging");
  -            
  -            root.addAppender( app );
  -            root.setPriority( Priority.INFO );
  -        }
  -        initialized=true;
  -    }
  -    
   
       /**
        * Log a message to the Log4j Logger with <code>TRACE</code> priority.
  
  
  

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


Mime
View raw message