You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by vg...@apache.org on 2005/04/26 19:26:06 UTC

svn commit: r164834 - /excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java

Author: vgritsenko
Date: Tue Apr 26 10:26:05 2005
New Revision: 164834

URL: http://svn.apache.org/viewcvs?rev=164834&view=rev
Log:
user friendly exception message if unknown log target was referenced by the category

Modified:
    excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java

Modified: excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java?rev=164834&r1=164833&r2=164834&view=diff
==============================================================================
--- excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java (original)
+++ excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java Tue Apr 26 10:26:05 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation
+ * Copyright 2002-2005 The Apache Software Foundation
  * Licensed  under the  Apache License,  Version 2.0  (the "License");
  * you may not use  this file  except in  compliance with the License.
  * You may obtain a copy of the License at
@@ -43,7 +43,7 @@
  * from a configuration file.
  *
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
- * @version CVS $Revision: 1.21 $ $Date: 2004/03/10 13:54:50 $
+ * @version SVN $Id$
  * @since 4.0
  */
 public class LogKitLoggerManager extends AbstractLoggerManager
@@ -478,6 +478,9 @@
         for( int i = 0; i < categories.length; i++ )
         {
             final String category = categories[ i ].getAttribute( "name" );
+            final String fullCategory =
+                    LoggerUtil.getFullCategoryName( parentCategory, category );
+
             final String loglevel = categories[ i ].getAttribute( "log-level" ).toUpperCase();
             final boolean additive = categories[ i ].
                 getAttributeAsBoolean( "additive", defaultAdditive );
@@ -488,6 +491,12 @@
             {
                 final String id = targets[ j ].getAttribute( "id-ref" );
                 logTargets[ j ] = targetManager.getLogTarget( id );
+                if (logTargets[ j ] == null)
+                {
+                    throw new ConfigurationException("Category <" + fullCategory + ">: " +
+                                                     "Target <" + id + "> is not defined.");
+                }
+
                 if( !m_targets.contains( logTargets[ j ] ) )
                 {
                     m_targets.add( logTargets[ j ] );
@@ -500,9 +509,6 @@
                 m_hierarchy.setDefaultLogTargets( logTargets );
                 rootLoggerAlive = true;
             }
-
-            final String fullCategory =
-                    LoggerUtil.getFullCategoryName( parentCategory, category );
 
             final org.apache.log.Logger logger = m_hierarchy.getLoggerFor( fullCategory );
             m_loggers.put( fullCategory, new LogKitLogger( logger ) );



---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org