CVS: plexus-container-new/src/java/org/apache/plexus/logging LoggerManagerFactory.java,1.3,1.4

[email protected] Sat, 3 May 2003 09:22:44 -0500
Newsgroups gmane.comp.java.plexus.devel
Message-ID <[email protected]>
Update of /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/logging
In directory eng.werken.com:/tmp/cvs-serv6939/src/java/org/apache/plexus/logging

Modified Files:
	LoggerManagerFactory.java 
Log Message:
o logging defaults


Index: LoggerManagerFactory.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/logging/LoggerManagerFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LoggerManagerFactory.java	1 May 2003 19:35:36 -0000	1.3
+++ LoggerManagerFactory.java	3 May 2003 14:22:42 -0000	1.4
@@ -12,10 +12,22 @@
         throws Exception
     {
         String implementation;
+        boolean loggingWithNoImplementationSpecified = false;
 
         if ( configuration.getChild( "logging", false ) != null )
         {
-            implementation = configuration.getChild( "logging" ).getChild( "implementation" ).getValue();
+            implementation =
+                configuration.getChild( "logging" ).getChild( "implementation" ).getValue( null );
+
+            if ( implementation == null
+                 ||
+                 implementation.trim().length() == 0 )
+            {
+                loggingWithNoImplementationSpecified = true;
+
+                implementation =
+                    defaultConfiguration.getChild( "logging" ).getChild( "implementation" ).getValue();
+            }
         }
         else
         {
@@ -28,6 +40,12 @@
         lm.configure( configuration );
         lm.initialize();
         lm.start();
+
+        if ( loggingWithNoImplementationSpecified )
+        {
+            lm.getRootLogger().warn( "A logging configuration was provided but no implementation was " +
+                                     "specified so the system has fallen back to the console logger manager." );
+        }
 
         return lm;
     }