se...@13f79535-47bb-0310-9956-ffa450edef68  committed 827f96b

Sample logkit configuration file

  • Participants
  • Parent commits 6cf9f2e
  • Branches default

Comments (0)

Files changed (1)

File bin/logkit.xml

+ Copyright 2001-2004 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
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ See the License for the specific language governing permissions and
+ limitations under the License.
+<logkit logger="system.logkit" log-level="INFO"
+   manager-class="org.apache.avalon.excalibur.logger.LogKitLoggerManager">
+	The manager-class is what determines the underlying log implementation
+	In this case, it is Avalon LogKit.
+	Not sure what logger and log-level are for.
+    <factories>
+      <factory type="file"
+           class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
+    </factories>
+    <targets>
+      <!-- Sample entry showing custom format -->
+      <file id="logFile" >
+         <append>false</append>
+         <filename>format.log</filename>
+         <format type="pattern">
+AT: %{time:yyyy/MM/dd HH:mm:ss} PRI: %5.5{priority} CAT: %{category} TEXT: %{message} EX: %{throwable}\n
+     	</format>     	
+      </file>
+      <!-- Sample entry showing unique names. SSS = milliseconds -->
+      <file id="logUnique" >
+         <append>false</append>
+         <filename>prefix</filename>
+         <rotation type="unique" pattern="yyyy-MM-dd-hh-mm-ss-SSS" suffix=".log">
+         	<size>1000000</size>
+         </rotation>
+         <!-- can also add a format here -->
+      </file>
+      <!--
+      	Sample entry showing how to rotate files, i.e. my_log.000001 etc
+      	-->
+      <file id="logRevolve" >
+         <append>false</append>
+         <filename>my_log</filename>
+         <rotation type="revolving" init="1" max="10">
+         	<size>1000000</size>
+         	</rotation>
+         <!-- can also add a format here -->
+      </file>
+    </targets>
+    <categories>
+      <!--
+      	Notes:
+      	* must define the default category, i.e. where name = "" 
+      	* each log-target id-ref must refer to a valid file entry
+      	-->
+      <category name="" log-level="INFO">
+        <log-target id-ref="logFile"/>
+      </category>
+      <!--
+      	Further categories can be defined if required; they can have
+      	the same or different targets, but the targets must exist
+      	-->
+      <category name="jorphan" log-level="WARN">
+        <log-target id-ref="logRevolver"/>
+      </category>
+    </categories>
+Documentation extracted from FileTargetFactory class.
+This factory is able to create different FileLogTargets according to the 
+ following configuration syntax: 
+ <file id="foo">
+  <filename>${context-key}/real-name/...</filename>
+  <format type="avalon|raw|pattern|extended">pattern to be used if needed</format>
+  <append>true|false</append>
+  <rotation type="revolving" init="5" max="10">
+ or
+  <rotation type="unique" pattern="yyyy-MM-dd-hh-mm-ss" suffix=".log">
+   <or>
+    <size>10000000</size>
+    <time>24:00:00</time>
+    <time>12:00:00</time>
+   </or>
+  </rotation>
+ </file>
+Some explanations about the Elements used in the configuration: 
+	 This denotes the name of the file to log to. It can be constructed out of entries in the 
+	  passed Context object as ${context-key}. This element is required. 
+	 The type attribute of the pattern element denotes the type of Formatter to be used and 
+	  according to it the pattern to use for. This elements defaults to: 
+%7.7{priority} %5.5{time} [%8.8{category}] (%{context}): %{message}\\n%{throwable} 
+<append> 	 If the log file should be deleted every time the logger is creates (normally at the 
+ start of the applcation) or not and thus the log entries will be appended. This elements defaults to 
+ false. 
+	 This is an optional element. The type attribute determines which FileStrategy to user 
+	  (revolving=RevolvingFileStrategy, unique=UniqueFileStrategy). The required init and max attribute 
+	  are used to determine the initial and maximum rotation to use on a type="revolving" attribute. The 
+	  optional pattern and suffix attribute are used to form filenames on a type="unique" attribute. 
+The initial rotation can be set to -1 in which case the system will first create the maximum number 
+ of file rotations by selecting the next available rotation and thereafter will overwrite the oldest log 
+ file. 
+	uses the OrRotateStrategy to combine the children
+	 The number of bytes if no suffix used or kilo bytes (1024) if suffixed with 'k' or mega bytes 
+	  (1024k) if suffixed with 'm' when a file rotation should occur. It doesn't make sense to specify more 
+	  than one. 
+	 The time as HH:MM:SS when a rotation should occur. If you like to rotate a logfile more 
+	  than once a day put an <or> element immediately after the <rotation> element and specify the 
+	  times (and one size, too) inside the <or> element. 
+	 Rotation occur when string formatted date changed. Specify date formatting pattern. 
+	 Interval at which a rotation should occur. The interval should be given in the format ddd:
+	  hh:mm:ss.