Qore Logger Module Reference 1.0
|
Implemants appender writing to a file with file circular rotation support. More...
#include <Logger.qm.dox.h>
Public Member Methods | |
constructor (*string name, LoggerLayout layout, string pattern, int count=DEFAULT_ROTATION_COUNT, *string encoding) | |
Creates the object. More... | |
int | getCount () |
Returns number of files in ring. | |
int | getCurrentIndex () |
Returns current ring index being used for logging. | |
processEventImpl (int type, auto params) | |
Implements filename rotation; handles the open and rotate events directly; passes all other events to the subclass for handling. More... | |
abstract int | getCount () |
Abstract method to get count of rotation objects. | |
Public Attributes | |
const | DEFAULT_DATE_FORMAT = "YYYYMMDDHHmmSS" |
default date format | |
Public Attributes inherited from Logger::AbstractLoggerAppenderFileRotate | |
const | DEFAULT_ROTATION_COUNT = 10 |
default value for rotation chain | |
const | EVENT_ROTATE = 10001 |
rotate event | |
Private Member Methods | |
*string | resolveField (auto data, string key, *string option) |
Returns a string for a format field for a pattern-based filename. More... | |
Implemants appender writing to a file with file circular rotation support.
The events will be logged to a file until rotation occurs. At that moment the current file is closed, next file is created and logging continues to the new file.
Logger::LoggerAppenderFileRing::constructor | ( | *string | name, |
LoggerLayout | layout, | ||
string | pattern, | ||
int | count = DEFAULT_ROTATION_COUNT , |
||
*string | encoding | ||
) |
Creates the object.
name | the name of the appender |
layout | the layout for the appender |
pattern | to generate the file name; see information below |
count | number of files in ring, if count is <=0 then no ratation is performed |
encoding | the encoding of the output file |
The following table explains the characters used in LoggerPattern and all other characters that you can use in your custom pattern:
Conversion character | Meaning |
i | Used to output the current file index from 0 to count-1. option may specify sprintf()() format, e.g. "%.3d" |
n | Used to output the rotation count. Option may specify sprintf()() format, e.g. "%.3d" |
c | Used to output the appender name. |
C | Used to output the appender class name. |
d | Used to output the date of the logging event using format_date(). Option may specify date format, e.g. "%d{DD.MM.YYYY HH:mm:SS}" , default value is "YYYYMMDDHHmmSS" |
E | Used to output the environment variable with name given by option, e.g. "%E{HOME}" |
% | The literal percent sign. "%%" will print a "%" sign |
For example, the pattern "/var/run/log/%c.log.%i{%03d}"
creates the following file names: "/var/run/log/MyLogger.log.000"
, "/var/run/log/MyLogger.log.001"
etc.
Logger::LoggerAppenderFileRing::processEventImpl | ( | int | type, |
auto | params | ||
) |
Implements filename rotation; handles the open and rotate events directly; passes all other events to the subclass for handling.
type | the event type |
params | event parameters |
|
private |
Returns a string for a format field for a pattern-based filename.
data | input context reference data |
key | the format character |
option | the format option value, if any |