cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: svn commit: r208646 - /cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
Date Thu, 30 Jun 2005 16:42:39 GMT
I haven't looked deeply into what has changed in trunk here, but I 
suspect that this change will cause me problems.  My Logger 
implementation needs to get the objectModel from the contextMap and is 
expecting it to be there.

Ralph

cziegeler@apache.org wrote:

>Author: cziegeler
>Date: Thu Jun 30 09:30:33 2005
>New Revision: 208646
>
>URL: http://svn.apache.org/viewcvs?rev=208646&view=rev
>Log:
>Only create context if LogKit is used
>
>Modified:
>    cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
>
>Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
>URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java?rev=208646&r1=208645&r2=208646&view=diff
>==============================================================================
>--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
>+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Thu Jun 30 09:30:33 2005
>@@ -96,6 +96,9 @@
>     /** The time the cocoon instance was created. */
>     protected long creationTime;
> 
>+    /** We use LogKit */
>+    protected boolean isLogKit = false;
>+
>     /**
>      * Setup a new instance.
>      * @param environment The hook back to the environment.
>@@ -374,19 +377,22 @@
>      * TODO - Move this to the logger manager and make it LogKit independent.
>      */
>     public Object initializePerRequestLoggingContext(Environment env) {
>-        ContextMap ctxMap;
>-        // Initialize a fresh log context containing the object model: it
>-        // will be used by the CocoonLogFormatter
>-        ctxMap = ContextMap.getCurrentContext();
>-        // Add thread name (default content for empty context)
>-        String threadName = Thread.currentThread().getName();
>-        ctxMap.set("threadName", threadName);
>-        // Add the object model
>-        ctxMap.set("objectModel", env.getObjectModel());
>-        // Add a unique request id (threadName + currentTime
>-        ctxMap.set("request-id", threadName + System.currentTimeMillis());
>-        
>-        return ctxMap;
>+        if ( this.isLogKit ) {
>+            ContextMap ctxMap;
>+            // Initialize a fresh log context containing the object model: it
>+            // will be used by the CocoonLogFormatter
>+            ctxMap = ContextMap.getCurrentContext();
>+            // Add thread name (default content for empty context)
>+            String threadName = Thread.currentThread().getName();
>+            ctxMap.set("threadName", threadName);
>+            // Add the object model
>+            ctxMap.set("objectModel", env.getObjectModel());
>+            // Add a unique request id (threadName + currentTime
>+            ctxMap.set("request-id", threadName + System.currentTimeMillis());
>+            
>+            return ctxMap;
>+        }
>+        return null;   
>     }
> 
>     /**
>@@ -568,8 +574,12 @@
>         }
>         try {
>             Class clazz = Class.forName(loggerManagerClass);
>+            if ( loggerManagerClass.equals(LogKitLoggerManager.class.getName()) ) {
>+                this.isLogKit = true;
>+            }
>             return (LoggerManager) clazz.newInstance();
>         } catch (Exception e) {
>+            this.isLogKit = true;
>             return new LogKitLoggerManager();
>         }
>     }
>
>
>  
>


Mime
View raw message