|
JMeter example source code file (logkit.xml)
The JMeter logkit.xml source code<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You 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. --> <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 <filename>format.log <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 <filename>prefix <rotation type="unique" pattern="yyyy-MM-dd-hh-mm-ss-SSS" suffix=".log"> <size>1000000 </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 <filename>my_log <rotation type="revolving" init="1" max="10"> <size>1000000 </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> </logkit> <!-- 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/... <format type="avalon|raw|pattern|extended">pattern to be used if needed <append>true|false <rotation type="revolving" init="5" max="10"> or <rotation type="unique" pattern="yyyy-MM-dd-hh-mm-ss" suffix=".log"> <or> <size>10000000 <time>24:00:00 <time>12:00:00 </or> </rotation> </file> Some explanations about the Elements used in the configuration: <filename> 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. <format> 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. <rotation> 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. <or> uses the OrRotateStrategy to combine the children <size> 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. <time> 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 Other JMeter examples (source code examples)Here is a short list of links related to this JMeter logkit.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.