avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 36837 - in avalon/trunk/runtime/logging: log4j/src/java/org/apache/avalon/logging/log4j spi/src/java/org/apache/avalon/logging/provider
Date Wed, 25 Aug 2004 05:00:46 GMT
Author: niclas
Date: Tue Aug 24 22:00:44 2004
New Revision: 36837

Added:
   avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/default.log4j.conf
Modified:
   avalon/trunk/runtime/logging/log4j/src/java/org/apache/avalon/logging/log4j/Log4JLoggingFactory.java
   avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/package.html
Log:
Fix for RUNTIME-54 issue. A ConsoleLogger and a SimpleLayout at WARN level is the default
Log4J config.

Modified: avalon/trunk/runtime/logging/log4j/src/java/org/apache/avalon/logging/log4j/Log4JLoggingFactory.java
==============================================================================
--- avalon/trunk/runtime/logging/log4j/src/java/org/apache/avalon/logging/log4j/Log4JLoggingFactory.java
(original)
+++ avalon/trunk/runtime/logging/log4j/src/java/org/apache/avalon/logging/log4j/Log4JLoggingFactory.java
Tue Aug 24 22:00:44 2004
@@ -17,12 +17,15 @@
  */
 
 package org.apache.avalon.logging.log4j;
-
+ 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 
 import java.net.URL;
 
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.avalon.logging.impl.DefaultLoggingCriteria;
 import org.apache.avalon.logging.provider.LoggingCriteria;
@@ -152,7 +155,13 @@
     }
 
     private void configure( URL url, long interval )
+        throws IOException
     {
+        if( url == null )
+        {
+            configureDefault();
+            return;
+        }
         String src = url.toExternalForm();
         if( src.startsWith( "file:" ) )
         {
@@ -161,7 +170,10 @@
                 src = src.substring( 1 );
             configureFile( src, interval );
         }
-        configureURL( url );
+        else
+        {
+            configureURL( url );
+        }
     }
     
     private void configureFile( String src, long interval )
@@ -204,6 +216,15 @@
         }
     }
 
+    private void configureDefault()
+        throws IOException
+    {
+        Properties conf = new Properties();
+        InputStream in = getClass().getClassLoader().getResourceAsStream( "default.log4j.conf"
);
+        conf.load( in );
+        PropertyConfigurator.configure( conf );
+    }
+    
     private LoggingCriteria getLoggingCriteria( Map criteriaMap )
     {
         if( criteriaMap instanceof LoggingCriteria )

Added: avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/default.log4j.conf
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/default.log4j.conf
Tue Aug 24 22:00:44 2004
@@ -0,0 +1,8 @@
+
+log4j.appender.console=org.apache.log4j.ConsoleLogger
+
+log4j.appender.console.layout=org.apache.log4j.SimpleLayout
+
+log4j.rootLogger=WARN, console
+
+  

Modified: avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/package.html
==============================================================================
--- avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/package.html
(original)
+++ avalon/trunk/runtime/logging/spi/src/java/org/apache/avalon/logging/provider/package.html
Tue Aug 24 22:00:44 2004
@@ -3,5 +3,6 @@
 {@link org.apache.avalon.logging.provider.LoggingManager} which
 is an interface to the initial logging management system that leverages meta 
 information about logging targets and catagories.
+
 </p>
 </body>

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message