cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r380149 - in /cocoon/trunk: cocoon-core/src/main/java/org/apache/cocoon/bean/ cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/ cocoon-core/src/main/java/...
Date Thu, 23 Feb 2006 16:39:21 GMT
Author: cziegeler
Date: Thu Feb 23 08:39:17 2006
New Revision: 380149

URL: http://svn.apache.org/viewcvs?rev=380149&view=rev
Log:
Clean up logging

Modified:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/CommandLineContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java
    cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/PortletContext.java

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java Thu Feb
23 08:39:17 2006
@@ -97,21 +97,21 @@
     public void initialize() throws Exception {
         // Install a temporary logger so that getDir() can log if needed
         // FIXME - make the level configurable
-        final Logger envLogger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
-        this.log = envLogger;
+        this.log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
+
+        this.cliContext = new CommandLineContext(this.contextDir, this.log);
 
         this.context = getDir(this.contextDir, "context");
         this.work = getDir(workDir, "working");
 
         this.conf = getConfigurationFile(this.context, this.configFile);
-        cliContext = new CommandLineContext(contextDir, envLogger);
 
         // setup Cocoon core
         File cacheDir = getDir(workDir + File.separator + "cache-dir", "cache");
 
         WrapperBootstrapper env = this.getBootstrapEnvironment();
         env.setContextDirectory(contextDir);
-        env.setEnvironmentLogger(envLogger);
+        env.setEnvironmentLogger(this.log);
         env.setEnvironmentContext(cliContext);
         env.setWorkingDirectory(this.work);
         env.setCachingDirectory(cacheDir);

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
Thu Feb 23 08:39:17 2006
@@ -155,7 +155,7 @@
                                        Settings       settings)
     throws Exception {
         // create a bootstrap logger
-        int logLevel;;
+        int logLevel;
         final String logLevelString = settings.getBootstrapLogLevel();
         if ( "DEBUG".equalsIgnoreCase(logLevelString) ) {
             logLevel = ServletLogger.LEVEL_DEBUG;

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/CommandLineContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/CommandLineContext.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/CommandLineContext.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/CommandLineContext.java
Thu Feb 23 08:39:17 2006
@@ -32,17 +32,47 @@
  */
 public class CommandLineContext extends AbstractContext implements Context {
 
-    /** The context directory path*/
+    /** The context directory path. */
     private String contextDir;
 
+    /** The logger for debugging etc. */
+    protected Logger logger;
+
     /**
      * Constructs a CommandlineContext object from a ServletContext object
      */
     public CommandLineContext(String contextDir, Logger logger) {
-        super(logger);
+        this.logger = logger;        
         String contextDirPath = new File(contextDir).getAbsolutePath();
         // store contextDirPath as is don't remove trailing /.
         this.contextDir = contextDirPath;
+    }
+
+    /**
+     * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
+     */
+    public void log(Exception arg0, String arg1) {
+        System.out.println(arg1);
+        if ( arg0 != null ) {
+            arg0.printStackTrace(System.out);
+        }
+    }
+
+    /**
+     * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
+     */
+    public void log(String arg0, Throwable arg1) {
+        System.out.println(arg0);
+        if ( arg1 != null ) {
+            arg1.printStackTrace(System.out);
+        }
+    }
+
+    /**
+     * @see javax.servlet.ServletContext#log(java.lang.String)
+     */
+    public void log(String arg0) {
+        System.out.println(arg0);
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpContext.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpContext.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpContext.java
Thu Feb 23 08:39:17 2006
@@ -23,7 +23,6 @@
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 
-import org.apache.avalon.framework.logger.NullLogger;
 import org.apache.cocoon.environment.impl.AbstractContext;
 
 /**
@@ -40,7 +39,6 @@
      * Constructs a HttpContext object from a ServletContext object
      */
     public HttpContext (ServletContext servletContext) {
-        super(new NullLogger());
         this.servletContext = servletContext;
     }
 

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
Thu Feb 23 08:39:17 2006
@@ -29,7 +29,6 @@
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.cocoon.environment.Context;
 
 /**
@@ -40,16 +39,9 @@
 public abstract class AbstractContext 
     implements Context, ServletContext {
 
-    /** The logger to use. */
-    protected final Logger logger;
-
     /** Attributes. */
     protected final Map attributes = new HashMap();
 
-    public AbstractContext(Logger logger) {
-        this.logger = logger;
-    }
-
     /**
      * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
      */
@@ -181,27 +173,6 @@
      */
     public Enumeration getServlets() {
         return null;
-    }
-
-    /**
-     * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
-     */
-    public void log(Exception arg0, String arg1) {
-        this.logger.info(arg1, arg0);
-    }
-
-    /**
-     * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
-     */
-    public void log(String arg0, Throwable arg1) {
-        this.logger.info(arg0, arg1);
-    }
-
-    /**
-     * @see javax.servlet.ServletContext#log(java.lang.String)
-     */
-    public void log(String arg0) {
-        this.logger.info(arg0);
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java Thu
Feb 23 08:39:17 2006
@@ -29,7 +29,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.avalon.excalibur.logger.ServletLogger;
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.cocoon.ConnectionResetException;

Modified: cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/PortletContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/PortletContext.java?rev=380149&r1=380148&r2=380149&view=diff
==============================================================================
--- cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/PortletContext.java
(original)
+++ cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/PortletContext.java
Thu Feb 23 08:39:17 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.environment.portlet;
 
-import org.apache.avalon.framework.logger.NullLogger;
 import org.apache.cocoon.environment.impl.AbstractContext;
 
 import java.io.InputStream;
@@ -40,7 +39,6 @@
      * Constructs a PortletContext object from a PortletContext object
      */
     public PortletContext(javax.portlet.PortletContext context) {
-        super(new NullLogger());
         this.context = context;
     }
 



Mime
View raw message