The following example shows a sample log configuration file that contains common attributes.
emapi_log.cfg file example with default parameters
log4j.rootLogger=ERROR
log4j.category.com.bmc.ctmem.emapi=ERROR, EMAPI_Appender
# set appender for EM/API
log4j.appender.EMAPI_Appender=org.apache.log4j.RollingFileAppender
log4j.appender.EMAPI_Appender.file=emapi_log_file
log4j.appender.EMAPI_Appender.append=true
log4j.appender.EMAPI_Appender.maxFileSize=10kb
log4j.appender.EMAPI_Appender.maxBackupIndex=2
log4j.appender.EMAPI_Appender.layout=org.apache.log4j.SimpleLayout
The first line (log4j.rootLogger=ERROR) sets the priority of the root category to ERROR. If your project code uses the Log4J library, the root category determines the highest overall priority of log messages.
The second line defines an appender for a specified category. The category can have multiple appenders. The appender that is defined here is assigned a logging priority.
The appender is EMAPI_Appender.
The category is com.bmc.ctmem.emapi.
The logging priority is ERROR.
The remaining lines of the example define the properties of the appender, EMAPI_Appender. The valid properties depend on the type of appender that is being defined.
This example shows a RollingFileAppender that has the properties discussed in the following table.
RollingFileAppender example properties
Code |
Description |
---|---|
file=emapi.log |
indicates that the log output file is named emapi.log |
append=true |
indicates that new information is added to the end of the log file |
maxFileSize=50kb |
indicates that the maximum file of the log file is 50 KB |
maxBackupIndex=2 |
indicates the number of backups made (that is, the number of old log files saved) |
layout=org.apache.log4j. |
indicates the format for entries to the log file |
Parent Topic |