You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/24 07:29:23 UTC
[Cocoon Wiki] Updated: ConfiguringTheLogs
Date: 2004-07-23T22:29:23
Editor: DavidCrossley <cr...@apache.org>
Wiki: Cocoon Wiki
Page: ConfiguringTheLogs
URL: http://wiki.apache.org/cocoon/ConfiguringTheLogs
See also JCSLogging
Change Log:
------------------------------------------------------------------------------
@@ -101,22 +101,22 @@
This example declares the !SerlvetTargetFactory, you may use {{{servlet}}} for defining a servlet log target in the following sections of the logkit.xconf file.
-{{{
-....
-<factories>
- <factory type="servlet"
- class="org.apache.avalon.excalibur.logger.factory.ServletTargetFactory"
- />
-...
-</factories>
-<targets>
-...
- <servlet...
- ....
- </servlet>
-...
-</targets>
-....
+{{{
+....
+<factories>
+ <factory type="servlet"
+ class="org.apache.avalon.excalibur.logger.factory.ServletTargetFactory"
+ />
+...
+</factories>
+<targets>
+...
+ <servlet...
+ ....
+ </servlet>
+...
+</targets>
+....
}}}
== !AsyncLogTargetFactory ==
@@ -133,10 +133,10 @@
The following configuration template configures a !AsyncLogTarget
-{{{
-<async-target id="async-target-id" queue-size="15" priority="MIN">
- ... any-target-definition ...
-</async-target>
+{{{
+<async-target id="async-target-id" queue-size="15" priority="MIN">
+ ... any-target-definition ...
+</async-target>
}}}
== !CocoonTargetFactory ==
@@ -156,15 +156,15 @@
directory Cocoon sets context-root to the sub-directory log of its
work-dir.)
-{{{
-<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>true</append>
-</cocoon>
+{{{
+<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>true</append>
+</cocoon>
}}}
''' Note if you change logKit.xconf, you must restart Tomcat '''
@@ -189,14 +189,14 @@
The following configuration template configures a !FileTarget, writing
logs to the file {{{/var/tmp/log1.log}}}.
-{{{
-<file>
- <filename>/var/tmp/log1.log</filename>
- <append>false</append>
- <format type="pattern">
- %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
- </format>
-</file>
+{{{
+<file>
+ <filename>/var/tmp/log1.log</filename>
+ <append>false</append>
+ <format type="pattern">
+ %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
+ </format>
+</file>
}}}
@@ -239,18 +239,18 @@
The time value of the log event is written to the column when of table cocoonlog.
The context entry uri is writting to column uri.
-{{{
-<database>
- <datasource>jdbc/logdb</datasource>
- <normalized>false</normalized>
- <table name="cocoonlog">
- <category>cat</category>
- <message>mesg</message>
- <priority>prior</priority>
- <time>when</time>
- <context aux="uri">uri</context>
- </table>
-</database>
+{{{
+<database>
+ <datasource>jdbc/logdb</datasource>
+ <normalized>false</normalized>
+ <table name="cocoonlog">
+ <category>cat</category>
+ <message>mesg</message>
+ <priority>prior</priority>
+ <time>when</time>
+ <context aux="uri">uri</context>
+ </table>
+</database>
}}}
== JMS!TargetFactory ==
@@ -278,10 +278,10 @@
The following configuration template configures a !PriorityLevelTarget
-{{{
-<priority-target id="priority-target-id" log-level="ERROR">
- ... any-target-definition ...
-</priority-target>
+{{{
+<priority-target id="priority-target-id" log-level="ERROR">
+ ... any-target-definition ...
+</priority-target>
}}}
== SMTP!TargetFactory ==
@@ -310,12 +310,12 @@
The following configuration template configures a !ServletTarget,
expecting a !ServletContext object available under context-key servlet-context.
-{{{
-<servlet id="servlet-target-id" context-key="servlet-context">
- <format type="pattern">
- %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
- </format>
-</servlet>
+{{{
+<servlet id="servlet-target-id" context-key="servlet-context">
+ <format type="pattern">
+ %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
+ </format>
+</servlet>
}}}
== !SocketTargetFactory ==
@@ -340,13 +340,13 @@
The following configuration template configures a !StreamTarget
-{{{
-<stream-target id="stream-target-id">
- <stream>System.out</stream>
- <format type="pattern">
- %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
- </format>
-</stream-target>
+{{{
+<stream-target id="stream-target-id">
+ <stream>System.out</stream>
+ <format type="pattern">
+ %7.7{priority} %{time} [%{category}] : %{message}\n%{throwable}
+ </format>
+</stream-target>
}}}
== L!F5TargetFactory ==
@@ -357,20 +357,20 @@
See also "quick start" !LogFactor5 instructions in LogFactorFiveHowto.
Use the following example configuration in order to use the GUI:
-{{{
-<logkit>
- <factories>
- ...
- <factory class="org.apache.avalon.excalibur.logger.factory.LF5TargetFactory" type="lf5"/>
- ...
- </factories>
- <targets>
- ...
- <lf5 id="core"/>
- ...
- </targets>
- ...
-</logkit>
+{{{
+<logkit>
+ <factories>
+ ...
+ <factory class="org.apache.avalon.excalibur.logger.factory.LF5TargetFactory" type="lf5"/>
+ ...
+ </factories>
+ <targets>
+ ...
+ <lf5 id="core"/>
+ ...
+ </targets>
+ ...
+</logkit>
}}}
Some notes:
@@ -386,8 +386,8 @@
This formater formats the !LogEvents according to a input pattern string.
The format of each pattern element can be
-{{{
-%[+|-][#[.#]]{field:subformat}
+{{{
+%[+|-][#[.#]]{field:subformat}
}}}
* The +||- indicates left or right justify.
@@ -408,15 +408,15 @@
A simple example of a typical !PatternFormatter format would be:
-{{{
- %{time} %5.5{priority}[%-10.10{category}]: %{message}
+{{{
+ %{time} %5.5{priority}[%-10.10{category}]: %{message}
}}}
This would produce a line like:
-{{{
- 1000928827905 DEBUG [ junit]: Sample message
+{{{
+ 1000928827905 DEBUG [ junit]: Sample message
}}}
The format string specifies that the logger should first print the time value of the log event without size restriction, then the priority of the log event with a minimum and maximum size of 5, then the category of the log event right justified with a minimum and maximum size of 10, followed by the message of the log event without any size restriction.
@@ -467,28 +467,28 @@
Specify a revolving file strategy using 4 files, rotate if writing more
than 10 MB logging date, or an hour of day in year has expired.
The files have suffix like {{{000001}}}
-{{{
-...
- <rotation type="revolving" init="1" max="4">
- <or>
- <size>10m</size>
- <date>DD:HH</date>
- </or>
- </rotation>
-...
+{{{
+...
+ <rotation type="revolving" init="1" max="4">
+ <or>
+ <size>10m</size>
+ <date>DD:HH</date>
+ </or>
+ </rotation>
+...
}}}
Specifying a unique file strategy, and rotate if more than
100 MB logging data has been written, or after 5 minutes of logging.
The files have suffix like {{{200211261127.log}}}.
-{{{
-<rotation type="unique" pattern="yyyyMMddHHmm" suffix=".log">
- <or>
- <size>100m</size>
- <time>00:05:00</time>
- </or>
-</rotation>
+{{{
+<rotation type="unique" pattern="yyyyMMddHHmm" suffix=".log">
+ <or>
+ <size>100m</size>
+ <time>00:05:00</time>
+ </or>
+</rotation>
}}}
A short date pattern summary
@@ -507,22 +507,22 @@
Defining the logkit.xconf file you want to use depends on the Cocoon environment.
* Servlet environment, you specify a servlet init parameter logkit config, eg.
-{{{
-...
-<init-param>
-<param-name>logkit-config</param-name>
-<param-value>/WEB-INF/logkit.xconf</param-value>
-</init-param>
-...
+{{{
+...
+<init-param>
+<param-name>logkit-config</param-name>
+<param-value>/WEB-INF/logkit.xconf</param-value>
+</init-param>
+...
}}}
* Commandline environment, specify the option {{{-k}}}, or {{{--logKitconfig}}}, eg.
-{{{
-java org.apache.Cocoon -k logkit.xconf ...
+{{{
+java org.apache.Cocoon -k logkit.xconf ...
}}}
, or
-{{{
-java org.apache.Cocoon --logKitconfig logkit.xconf ...
+{{{
+java org.apache.Cocoon --logKitconfig logkit.xconf ...
}}}
@@ -531,38 +531,39 @@
This snippet configures a file rotation, rotating
the file every 5 minutes, or if the file size exceeds 2MB. The filename suffixes represents the date and time of file creation, eg. {{{access.log20021209 151231.log}}}.
-{{{
-<logkit>
- <factories>
- <factory type="file"
- class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"
- />
- </factories>
- <targets>
- <file>
- <filename>/tmp/access.log</filename>
- <format pattern="extended">
- %7.7{priority} %{time} [%{category}]: %{message}\n%{throwable}
- </format>
- <append>false</append>
- <rotation type="unique" pattern="yyyyMMdd HHmmss" suffix=".log">
- <or>
- <size>2m</size>
- <time>00:05:00</time>
- </or>
- </rotation>
- </file>
- </targets>
- <categories>
- <category name="my-cat-1" log-level="DEBUG">
- <log-target id-ref="file"/>
- </category>
- </categories>
-</logkit>
+{{{
+<logkit>
+ <factories>
+ <factory type="file"
+ class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"
+ />
+ </factories>
+ <targets>
+ <file>
+ <filename>/tmp/access.log</filename>
+ <format pattern="extended">
+ %7.7{priority} %{time} [%{category}]: %{message}\n%{throwable}
+ </format>
+ <append>false</append>
+ <rotation type="unique" pattern="yyyyMMdd HHmmss" suffix=".log">
+ <or>
+ <size>2m</size>
+ <time>00:05:00</time>
+ </or>
+ </rotation>
+ </file>
+ </targets>
+ <categories>
+ <category name="my-cat-1" log-level="DEBUG">
+ <log-target id-ref="file"/>
+ </category>
+ </categories>
+</logkit>
}}}
== See Also ==
- * LogFactorFiveHowto
- * ExploringTheLogs
- * [http://jakarta.apache.org/avalon/logkit/index.html AvalonLogKit]
- * [http://jakarta.apache.org/avalon/excalibur/logger/index.html ExcaliburLogger]
+ * ExploringTheLogs
+ * [:JCSLogging]
+ * LogFactorFiveHowto
+ * [http://jakarta.apache.org/avalon/logkit/index.html AvalonLogKit]
+ * [http://jakarta.apache.org/avalon/excalibur/logger/index.html ExcaliburLogger]