cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r159513 - cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
Date Wed, 30 Mar 2005 19:22:59 GMT
Author: vgritsenko
Date: Wed Mar 30 11:22:58 2005
New Revision: 159513

URL: http://svn.apache.org/viewcvs?view=rev&rev=159513
Log:
give cocoon object its own sub-category.

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java?view=diff&r1=159512&r2=159513
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java Wed Mar 30 11:22:58 2005
@@ -26,6 +26,7 @@
 import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -79,6 +80,9 @@
 
     static Cocoon instance;
 
+    /** The root Cocoon logger */
+    private Logger rootLogger;
+
     /** The application context */
     private Context context;
 
@@ -91,11 +95,11 @@
     /** The parent service manager. */
     private ServiceManager parentServiceManager;
 
-    /** flag for disposed or not */
-    private boolean disposed = false;
+    /** Flag for disposed or not */
+    private boolean disposed;
 
-    /** active request count */
-    private volatile int activeRequestCount = 0;
+    /** Active request count */
+    private volatile int activeRequestCount;
 
     /** the Processor */
     private Processor processor;
@@ -126,6 +130,11 @@
         instance = this;
     }
 
+    public void enableLogging(Logger logger) {
+        this.rootLogger = logger;
+        super.enableLogging(logger.getChildLogger("cocoon"));
+    }
+
     /**
      * Get the parent service manager. For purposes of
      * avoiding extra method calls, the manager parameter may be null.
@@ -172,12 +181,9 @@
      */
     public void initialize() throws Exception {
         this.serviceManager = new CocoonServiceManager(this.parentServiceManager);
-        ContainerUtil.enableLogging(this.serviceManager, getLogger().getChildLogger("manager"));
+        ContainerUtil.enableLogging(this.serviceManager, this.rootLogger.getChildLogger("manager"));
         ContainerUtil.contextualize(this.serviceManager, this.context);
-
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("Initializing new Cocoon object.");
-        }
+        getLogger().debug("Initializing new Cocoon object.");
 
         // Log the System Properties.
         dumpSystemProperties();
@@ -193,7 +199,7 @@
 
         this.environmentHelper = new EnvironmentHelper(
                 (URL) this.context.get(ContextHelper.CONTEXT_ROOT_URL));
-        ContainerUtil.enableLogging(this.environmentHelper, getLogger());
+        ContainerUtil.enableLogging(this.environmentHelper, this.rootLogger);
         ContainerUtil.service(this.environmentHelper, this.serviceManager);
 
         this.sourceResolver = (SourceResolver)this.serviceManager.lookup(SourceResolver.ROLE);
@@ -266,7 +272,7 @@
             }
 
             RoleManager urm = new RoleManager(drm);
-            ContainerUtil.enableLogging(urm, getLogger().getChildLogger("roles").getChildLogger("user"));
+            ContainerUtil.enableLogging(urm, this.rootLogger.getChildLogger("roles").getChildLogger("user"));
             ContainerUtil.configure(urm, roleConfig);
             roleConfig = null;
             drm = urm;
@@ -275,9 +281,7 @@
         this.serviceManager.setRoleManager(drm);
         this.serviceManager.setLoggerManager(this.loggerManager);
 
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("Setting up components...");
-        }
+        getLogger().debug("Setting up components...");
         ContainerUtil.configure(this.serviceManager, conf);
     }
 
@@ -530,7 +534,7 @@
         try {
             if (getLogger().isDebugEnabled()) {
                 ++activeRequestCount;
-                this.debug(environment, true);
+                debug(environment, true);
             }
 
             return this.processor.buildPipeline(environment);



Mime
View raw message