You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/03/30 20:42:02 UTC

svn commit: r159504 - in cocoon/branches/BRANCH_2_1_X/src: blocks/apples/conf/ blocks/cron/conf/ blocks/slide/conf/ blocks/woody/conf/ webapp/WEB-INF/

Author: vgritsenko
Date: Wed Mar 30 10:42:00 2005
New Revision: 159504

URL: http://svn.apache.org/viewcvs?view=rev&rev=159504
Log:
sync logging configuration cleanup with 2.2:
simplify default log config, remove extra targets

Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/apples/conf/apples-category.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/apples/conf/apples-target.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-category.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-target.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/slide/conf/slide-category.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/slide/conf/slide-target.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/conf/woody-category.xlog
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/conf/woody-target.xlog
Modified:
    cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/logkit.xconf

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=159503&r2=159504
==============================================================================
--- 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 Wed Mar 30 10:42:00 2005
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Copyright 1999-2004 The Apache Software Foundation
 
@@ -15,148 +15,129 @@
   limitations under the License.
 -->
 
+<!--+
+    | This is the cocoon logkit configuration file.
+    |
+    | By default, Cocoon uses Excalibur logkit for logging, but it also
+    | supports Log4J. In case you want to use Log4J, you have to modify
+    | a configuration property in the 'WEB-INF/web.xml' file (search
+    | for log4j and you find it)
+    |
+    | The comments below should get you started in adapting the logs
+    | for your needs, but if you want to know more please visit
+    |
+    |   http://wiki.apache.org/cocoon/ConfiguringTheLogs
+    |
+    | $Id$
+    +-->
 <logkit>
+
+  <!--+
+      | Factories are responsible to create the consumers of the log events,
+      | the targets. Here we have configured just a few, the main cocoon
+      | target factory (that prints to a file) and the servlet target factory
+      | (that prints back to the servlet container log stream) but  for more
+      | info on the available logkit factories, please consult
+      | http://excalibur.apache.org/apidocs/org/apache/avalon/excalibur/logger/factory/package-summary.html
+      +-->
   <factories>
-    <factory type="priority-filter" class="org.apache.avalon.excalibur.logger.factory.PriorityFilterTargetFactory"/>
-    <factory type="servlet" class="org.apache.avalon.excalibur.logger.factory.ServletTargetFactory"/>
     <factory type="cocoon" class="org.apache.cocoon.util.log.CocoonTargetFactory"/>
-    <factory type="lf5" class="org.apache.avalon.excalibur.logger.factory.LF5TargetFactory"/>
+    <factory type="servlet" class="org.apache.avalon.excalibur.logger.factory.ServletTargetFactory"/>
+    <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
   </factories>
 
+  <!--+
+      | Targets are the instances of the consumers of the log events and various
+      | instances can be configured and referenced via their 'id'.
+      | Note how the element name of the target indicates what type of factory
+      | that is created with.
+      +-->
   <targets>
 
-    <!-- To enable the LogFactor5 graphical logkit browser, replace the cocoon factory 
-         below with the following.
-    <lf5 id="core"/>
-    -->
-
-    <cocoon id="core">
-      <filename>${context-root}/WEB-INF/logs/core.log</filename>
-      <format type="cocoon">
-        %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-      </format>
-      <!--
-        append=false: Will override existing log files on Cocoon startup
-        append=true: Will append to the existing log files
-      -->
+    <cocoon id="main">
+      <!--+
+          | <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/cocoon.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">%5.5{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n</format>
+      <!--format type="cocoon">%5.5{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>false</append>
-      <!--
-        rotation: allows you to rotate log files one they meet certain
-                  criteria. In example below, files are rotated once they
-                  are one hour old or bigger than 100 Mb.
 
-      <rotation type="revolving" init="1" max="4">
+      <!--+
+          | <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>01:00:00</time>
+          <time>24:00:00</time>
         </or>
       </rotation>
-      -->
-    </cocoon>
-
-    <cocoon id="sitemap">
-      <filename>${context-root}/WEB-INF/logs/sitemap.log</filename>
-      <format type="cocoon">
-        %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-      </format>
-      <append>false</append>
-    </cocoon>
-
-    <cocoon id="handled-errors">
-      <filename>${context-root}/WEB-INF/logs/handled-errors.log</filename>
-      <format type="cocoon">
-        %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-      </format>
-      <append>false</append>
-    </cocoon>
-
-    <cocoon id="access">
-      <filename>${context-root}/WEB-INF/logs/access.log</filename>
-      <format type="cocoon">
-        %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-      </format>
-      <append>false</append>
-    </cocoon>
-
-    <!-- The logger for the flow layer -->
-    <cocoon id="flow">
-      <filename>${context-root}/WEB-INF/logs/flow.log</filename>
-      <format type="cocoon">
-        %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-      </format>
-      <append>false</append>
+          +-->
     </cocoon>
 
     <cocoon id="deprecation">
       <filename>${context-root}/WEB-INF/logs/deprecation.log</filename>
-      <format type="cocoon">%7.7{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n</format>
+      <format type="cocoon">%5.5{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n</format>
       <append>true</append>
     </cocoon>
 
-    <!--
-      This log file gets only messages with log level ERROR and below.
-    -->
-    <priority-filter id="error" log-level="ERROR">
-      <cocoon>
-        <filename>${context-root}/WEB-INF/logs/error.log</filename>
-        <format type="cocoon">
-          %7.7{priority} %{time}   [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
-        </format>
-        <append>false</append>
-      </cocoon>
-    </priority-filter>
+    <servlet id="servlet">
+      <format type="extended">%5.5{priority} %5.5{time} [%8.8{category}] (%{context}): %{message}\n</format>
+    </servlet>
+
+    <stream id="console">
+      <stream>System.out</stream>
+      <format type="extended">%5.5{priority} %5.5{time} [%8.8{category}] (%{context}): %{message}\n</format>
+    </stream>
   </targets>
 
+  <!--+
+      | Categories 'route' log events to particular targets, filtering
+      | on importance level (one of DEBUG, INFO, WARN, ERROR, FATAL_ERROR, 
+      | ordered from most verbose to least verbose) and on the 'category'
+      | used by the producer of the log event to further classify it.
+      | Some of these log categories are hardwired in the code and some
+      | others are user-selectable, for example for sitemap components
+      | where you can specify the category in their sitemap declaration.
+      |
+      | Category names can be dot-separated (example, 'sitemap.generator.file')
+      | and the variuos pieces are treated as 'sub-categories'. By nesting
+      | the <category> element you achieve sub-category filtering and you can
+      | even have different log level filtering per category and subcategory. 
+      | (See the comments below for an example of this)
+      |
+      | NOTE: not all subcategories are defined in this file. Not defined
+      | subcategories will be created automatically and they will inherit 
+      | the settings of the parent subcategory. When defining a subcategory 
+      | manually, it is required that you specify the log target, because 
+      | they are not inherited in this case.
+      +-->
   <categories>
-    <!--
-      log-level: One of DEBUG, INFO, WARN, ERROR, FATAL_ERROR.
-      Log level could be different for every category and subcategory.
-
-      Not all subcategories are defined in this file. Not defined
-      subcategories will be created automatically inheriting settings
-      of the parent subcategory.
-      When defining subcategory manually, it is required to specify log
-      targets, because they are not inherited in this case.
-    -->
-    <category name="core" log-level="@loglevel@">
-      <!-- Startup component manager logger -->
-      <category name="startup" log-level="@loglevel@">
-        <log-target id-ref="core"/>
-        <log-target id-ref="error"/>
-      </category>
-
-      <category name="roles" log-level="@loglevel@">
-        <log-target id-ref="core"/>
-        <log-target id-ref="error"/>
-      </category>
-
-      <category name="instrument" log-level="@loglevel@">
-        <category name="values" log-level="@loglevel@">
-          <log-target id-ref="core"/>
-          <log-target id-ref="error"/>
-        </category>
-        <log-target id-ref="core"/>
-        <log-target id-ref="error"/>
-      </category>
-
-      <!-- Cocoon component manager logger -->
-      <category name="manager" log-level="@loglevel@">
-        <log-target id-ref="core"/>
-        <log-target id-ref="error"/>
-      </category>
-
-      <!-- Cocoon cache and stores logger -->
-      <category name="store" log-level="@loglevel@">
-        <category name="janitor" log-level="@loglevel@">
-          <log-target id-ref="core"/>
-          <log-target id-ref="error"/>
-        </category>
-        <log-target id-ref="core"/>
-        <log-target id-ref="error"/>
-      </category>
 
-      <log-target id-ref="core"/>
-      <log-target id-ref="error"/>
+    <!--+
+        | This is the main category. The empty name attribute indicates that
+        | this rule will match all log events from all categories.
+        +-->
+    <category log-level="@loglevel@" name="">
+      <log-target id-ref="main"/>
     </category>
 
     <!--+
@@ -168,30 +149,23 @@
       <log-target id-ref="deprecation"/>
     </category>
 
-    <category name="sitemap" log-level="@loglevel@">
-      <log-target id-ref="sitemap"/>
-      <log-target id-ref="error"/>
-
-      <category name="handled-errors" log-level="@loglevel@">
-        <!-- Exceptions that will be handled by a sitemap errorhandler are
-             logged to this target. -->
-        <log-target id-ref="handled-errors"/>
+    <!--+
+        | This is a little more elaborate example, where some of the logs are 
+        | sent to the log file and some others (the ones related to the sitemap), 
+        | are sent to the servlet container (where they could be further relayed 
+        | to the console, for example)
+        |
+    <category log-level="ERROR" name="">
+      <category log-level="DEBUG" name="sitemap">
+        <log-target id-ref="servlet"/>
+      </category>
+      <category log-level="INFO" name="access">
+        <log-target id-ref="console"/>
       </category>
-    </category>
-
-    <category name="access" log-level="@loglevel@">
-      <log-target id-ref="access"/>
-      <log-target id-ref="error"/>
-    </category>
-
-    <category name="flow" log-level="@loglevel@">
-      <log-target id-ref="flow"/>
-      <log-target id-ref="error"/>
-    </category>
-
-    <category name="" log-level="@loglevel@">
       <log-target id-ref="core"/>
-      <log-target id-ref="error"/>
     </category>
+        +-->
+
   </categories>
+
 </logkit>