The configurator classes PropertyConfigurator and ModulePropertyConfigurator can load configuration files at run-time. This topic discusses the format of these files.
The configuration file format for cpplog is a subset of that used by log4cxx.
# Comment log.rootLogger=ERROR, A, B log.appender.A=AtlTraceAppender log.appender.A.layout=PatternLayout log.appender.A.layout.ConversionPattern=%-5p %c - %m%n log.appender.B=FileAppender log.appender.B.File=c:\Logs\RtdHandleServer_log.txt log.appender.B.layout=PatternLayout log.appender.B.layout.ConversionPattern=%-20.20d %-5p %c - %m [%l]%n log.logger.RtdHandleServer.Global=ERROR log.logger.RtdHandleServer.CXllRtdHandleServer=TRACE log.logger.RtdHandleServer.CTopicTable=TRACE
log.rootLogger=Level[, AppenderName...]
Part | Description |
---|---|
Level | One of FATAL, ERROR, WARN, INFO, DEBUG, TRACE. Not case-sensitive. |
AppenderName | The name of an appender defined in the same file (see below). |
Examples
log.rootLogger=ERROR, A, B log.rootLogger=TRACE
log.logger.LoggerName=Level[, AppenderName...]
Part | Description |
---|---|
LoggerName | The full name of the logger, case-sensitive. |
Level | One of FATAL, ERROR, WARN, INFO, DEBUG, TRACE. Not case-sensitive. |
AppenderName | The name of an appender defined in the same file (see below). |
Examples
log.logger.RtdHandleServer=ERROR, FileAppender1 log.logger.RtdHandleServer.CXllRtdHandleServer=TRACE log.logger.RtdHandleServer.CTopicTable=TRACE, TraceAppender, FileAppender
log.appender.AppenderName=AppenderType
Part | Description |
---|---|
AppenderName | The name of the appender, case-sensitive.
The name has meaning only inside the current configuration file,
where it can be used in the right-hand-side of logger
and rootLogger statements. |
AppenderType | A class identifier. In cpplog, only the last part of the identifier is used; the namespaces that precede the class name are ignored. |
Examples
log.appender.B=FileAppender log.appender.B=log4j.Appenders.FileAppender log.appender.DebugAppender=TraceAppender
Note that the first two examples above are exactly equivalent.
log.appender.AppenderName.layout=LayoutType
Part | Description |
---|---|
AppenderName | The name of the appender, case-sensitive. This must be an appender that has been declared in a previous line. |
LayoutType | A class identifier. In cpplog, only the last part of
the identifier is used; the namespaces that precede the class name are ignored.
Currently, only PatternLayout is supported. |
Example
log.appender.B.layout=PatternLayout
This statement can be omitted.
log.appender.AppenderName.layout.ConversionPattern=Pattern
Part | Description |
---|---|
AppenderName | The name of the appender, case-sensitive. This must be an appender that has been declared in a previous line. |
Pattern | A formatting pattern. See Formatting patterns for details. |
Example
log.appender.B.layout.ConversionPattern=%-20.20d %-5p %c - %m [%l]%n
log.appender.AppenderName.File=FileName
Part | Description |
---|---|
AppenderName | The name of the appender, case-sensitive. This must be an appender that has been declared in a previous line. |
FileName | The full name, including path, of the destination file of a FileAppender. |
Example
log.appender.B.File=C:\Logs\logfile.txt