cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r153523 - in cocoon/branches/BRANCH_2_1_X: ./ src/java/org/apache/cocoon/ src/java/org/apache/cocoon/util/log/ src/webapp/WEB-INF/
Date Sat, 12 Feb 2005 18:09:36 GMT
Author: cziegeler
Date: Sat Feb 12 10:09:35 2005
New Revision: 153523

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

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

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/Cocoon.java?view=diff&r1=153522&r2=153523
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/Cocoon.java Sat Feb 12 10:09:35
2005
@@ -57,6 +57,7 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.util.ClassUtils;
+import org.apache.cocoon.util.log.DeprecationLogger;
 import org.apache.commons.lang.SystemUtils;
 
 import org.apache.excalibur.instrument.InstrumentManageable;
@@ -194,6 +195,7 @@
      */
     public void setLoggerManager(LoggerManager loggerManager) {
         this.loggerManager = loggerManager;
+        DeprecationLogger.logger = this.loggerManager.getLoggerForCategory("deprecation");
     }
 
     /**

Added: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/DeprecationLogger.java?view=auto&rev=153523
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
Sat Feb 12 10:09:35 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/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/log/DeprecationLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/logkit.xconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/logkit.xconf?view=diff&r1=153522&r2=153523
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/logkit.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/logkit.xconf Sat Feb 12 10:09:35 2005
@@ -87,6 +87,45 @@
       <append>false</append>
     </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>
+
     <!--
       This log file gets only messages with log level ERROR and below.
     -->
@@ -117,6 +156,15 @@
       <category name="startup" log-level="@loglevel@">
         <log-target id-ref="core"/>
         <log-target id-ref="error"/>
+      </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>
 
       <category name="roles" log-level="@loglevel@">

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&r1=153522&r2=153523
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Sat Feb 12 10:09:35 2005
@@ -202,6 +202,9 @@
 
   <changes>
   <release version="@version@" date="@date@">
+   <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, castor to 0.9.6.
    </action>



Mime
View raw message