cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r153522 - cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java cocoon/trunk/src/webapp/WEB-INF/logkit.xconf cocoon/trunk/status.xml
Date Sat, 12 Feb 2005 18:00:54 GMT
Author: cziegeler
Date: Sat Feb 12 10:00:53 2005
New Revision: 153522

URL: http://svn.apache.org/viewcvs?view=rev&rev=153522
Log:
 Add a deprecation logger that gives hint about used deprecated stuff.

Added:
    cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java   (with props)
Modified:
    cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
    cocoon/trunk/src/webapp/WEB-INF/logkit.xconf
    cocoon/trunk/status.xml

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=153521&r2=153522
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java Sat Feb 12 10:00:53 2005
@@ -50,6 +50,7 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.cocoon.util.log.DeprecationLogger;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
@@ -162,6 +163,7 @@
      */
     public void setLoggerManager(LoggerManager loggerManager) {
         this.loggerManager = loggerManager;
+        DeprecationLogger.logger = this.loggerManager.getLoggerForCategory("deprecation");
     }
 
     /* (non-Javadoc)

Added: cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java?view=auto&rev=153522
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java Sat Feb 12 10:00:53
2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.util.log;
+
+import org.apache.avalon.framework.logger.Logger;
+
+/**
+ * This class provides static accessors for a special "deprecation" logger.
+ * All deprecated code should use this logger to log warnings into the 
+ * deprecation log. This makes it easier for users to find out if they're 
+ * using deprecated stuff.
+ *
+ * @version $Id$
+ */
+public class DeprecationLogger {
+
+    /** This is the logger used to log the warn messages.
+     *  THIS IS AN INTERNAL FIELD, DON'T USE IT DIRECTLY.
+     */
+    public static Logger logger;
+    
+    public static void log(String message) {
+        logger.warn(message);
+    }
+}

Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/src/webapp/WEB-INF/logkit.xconf
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/WEB-INF/logkit.xconf?view=diff&r1=153521&r2=153522
==============================================================================
--- cocoon/trunk/src/webapp/WEB-INF/logkit.xconf (original)
+++ cocoon/trunk/src/webapp/WEB-INF/logkit.xconf Sat Feb 12 10:00:53 2005
@@ -76,6 +76,45 @@
       </rotation-->
     </cocoon>
 
+    <cocoon id="deprecation">
+      <!--+
+          | <filename> is the absolute location of the log file, note how you can
+          | use the ${context-root} variable to indicate the root of the
+          | cocoon web application (the directory that contains WEB-INF, that is)
+          +-->
+      <filename>${context-root}/WEB-INF/logs/deprecation.log</filename>
+
+      <!--+
+          | <format> indicates how the log event should be serialized.
+          | Note that newlines are *not* automatic: you have to specify the
+          | newline as '\n' or everything will appear on a single line!
+          | The first format below is less verbose because it won't print out
+          | the error stacktrace (which tend to be very verbose and for little value).
+          | If you need the stacktraces, uncomment the second format below.
+          +-->
+      <format type="cocoon">%7.7{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}:
%{message}\n</format>
+      <!--format type="cocoon">%7.7{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}:
%{message}\n%{throwable}</format-->
+
+      <!--+
+          | <append> if set to 'true' will make cocoon append the events
+          | to the existing file, if set to 'false' cocoon will override
+          | the existing ones at every new start.
+          +-->
+      <append>true</append>
+
+      <!--+
+          | <rotation> allows you to rotate log files one they meet certain
+          | criteria. If you uncomment the example below, the log files will
+          | be rotated once they are a day old or bigger than 100 Mb.
+          +-->
+      <!--rotation type="unique" pattern="yyyyMMdd" suffix=".log">
+        <or>
+          <size>100m</size>
+          <time>24:00:00</time>
+        </or>
+      </rotation-->
+    </cocoon>
+
     <servlet id="servlet">
       <format type="extended">%7.7{priority} %5.5{time} [%8.8{category}] (%{context}):
%{message}\n</format>
     </servlet>
@@ -111,6 +150,15 @@
         +-->
     <category log-level="ERROR" name="">
       <log-target id-ref="main"/>
+    </category>
+
+    <!--+
+        | This is the deprecation category. If this category is set to WARN
+        | the log will contain messages about deprecated stuff used by
+        | your application.
+        +-->
+    <category log-level="WARN" name="deprecation">
+      <log-target id-ref="deprecation"/>
     </category>
 
     <!--+

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&r1=153521&r2=153522
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Sat Feb 12 10:00:53 2005
@@ -475,6 +475,9 @@
    </action>
  </release>
  <release version="2.1.7" date="TBD">
+   <action dev="CZ" type="update">
+     Add a deprecation logger that gives hint about used deprecated stuff.
+   </action>
    <action dev="AG" type="update">
      Updated commons-transaction to 1.0.1.
    </action>



Mime
View raw message