Log4j 1.2 Usage
|
Log4j 2.0 Usage
|
wt.log4j.jmx.ConsoleAppender
# Define stdout appender, which sends log events to stdout
log4j.appender.stdout=wt.log4j.jmx.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%-5p : %c %X{user} - %m%n |
Console
# Define stdout appender, which sends log events to stdout
appender.stdout.type = Console appender.stdout.name = stdout appender.stdout.follow = false appender.stdout.layout.type = PatternLayout appender.stdout.layout.alwaysWriteExceptions = false appender.stdout.layout.pattern = %-5p : %c %X{user} - %m%ex%n |
Log4j 1.2 Usage
|
Log4j 2.0 Usage
|
wt.log4j.jmx.DailyRollingFileAppender
# Define methodServerLogFile appender, which sends log events to a file
log4j.appender.methodServerLogFile=wt.log4j.jmx.DailyRollingFileAppender log4j.appender.methodServerLogFile.File=${wt.logs.dir}/${wt.manager.serviceName}-${wt.jvm.startTime.formatted.short}-${wt.jvm.id}-log4j.log log4j.appender.methodServerLogFile.DatePattern='.'yyyy-MM-dd log4j.appender.methodServerLogFile.layout=org.apache.log4j.PatternLayout log4j.appender.methodServerLogFile.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c %X{user} - %m%n |
RollingFile
# Define methodServerLogFile appender, which sends log events to a file
appender.methodServerLogFile.type = RollingFile appender.methodServerLogFile.name = methodServerLogFile appender.methodServerLogFile.createOnDemand = true appender.methodServerLogFile.fileName = ${sys:wt.logs.dir}/${sys:wt.manager.serviceName}-${sys:wt.jvm.startTime.formatted.short}-${sys:wt.jvm.id}-log4j.log appender.methodServerLogFile.filePattern = ${sys:wt.logs.dir}/${sys:wt.manager.serviceName}-${sys:wt.jvm.startTime.formatted.short}-${sys:wt.jvm.id}-log4j.log.%d{yyyy-MM-dd}_%i appender.methodServerLogFile.layout.type = PatternLayout appender.methodServerLogFile.layout.alwaysWriteExceptions = false appender.methodServerLogFile.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t] %c %X{user} - %m%ex%n appender.methodServerLogFile.policies.type = Policies appender.methodServerLogFile.policies.time.type = TimeBasedTriggeringPolicy appender.methodServerLogFile.policies.time.interval = 1 appender.methodServerLogFile.policies.time.modulate = true appender.methodServerLogFile.policies.size.type = SizeBasedTriggeringPolicy appender.methodServerLogFile.policies.size.size=9MB appender.methodServerLogFile.strategy.type = DefaultRolloverStrategy appender.methodServerLogFile.strategy.max = 2147483647 For date patterns in log4jMethodServer.properties, see the example:
appender.methodServerLogFile.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}{${timeZone}} %-5p [%t] %c %X{user} - %m%ex%n
For RollingFileAppender rollover policies, see the example:
appender.methodServerLogFile.filePattern = ${sys:wt.logs.dir}/${sys:wt.manager.serviceName}-${sys:wt.jvm.startTime.formatted.short}-${sys:wt.jvm.id}-log4j.log.%d{yyyy-MM-dd}_%i
appender.methodServerLogFile.policies.type = Policies appender.methodServerLogFile.policies.midnight.type = SizeBasedMidnightTriggeringPolicy appender.methodServerLogFile.policies.midnight.size=9MB appender.methodServerLogFile.strategy.type = DefaultRolloverStrategy appender.methodServerLogFile.strategy.max = 2147483647 ${timeZone} parameter should be used for date pattern in log4jMethodServer.properties only. It is mandatory to have the %d{yyyy-MM-dd}_%i file pattern for RolingFile appender.
|
Log4j 1.2 Usage
|
Log4j 2.0 Usage
|
wt.log4j.jmx.AsyncJDBCAppender
# Define MiscLogEvents appender, which sends log events (of sufficiently high severity) to the database
log4j.appender.MiscLogEvents=wt.log4j.jmx.AsyncJDBCAppender log4j.appender.MiscLogEvents.BatchSize=200 log4j.appender.MiscLogEvents.IncludeMDC=true log4j.appender.MiscLogEvents.threshold=WARN # Throttle logging of exception traces to the database (adjust threshold as needed) log4j.appender.MiscLogEvents.ThrowableElideThreshold=15 |
wt.log4j.jmx.AsyncJDBCAppender
# Define MiscLogEvents appender, which sends log events (of sufficiently high severity) to the database
appender.MiscLogEvents.name=MiscLogEvents appender.MiscLogEvents.type=AsyncJDBCAppender appender.MiscLogEvents.BatchSize=200 appender.MiscLogEvents.IncludeMDC=true appender.MiscLogEvents.filter.threshold.type=ThresholdFilter appender.MiscLogEvents.filter.threshold.level=WARN # Throttle logging of exception traces to the database (adjust threshold as needed) appender.MiscLogEvents.ThrowableElideThreshold=15 |
Log4j 1.2 Usage
|
Log4j 2.0 Usage
|
wt.log4j.jmx.IncomingRmiStatsAppender
# Configure IncomingRmiStats appender
# Collects RMI statistics for viewing with wt.rmi.jmx.IncomingRmiStatsMonitor MBean; # must instantiate this MBean (via MBean Loader) to access results log4j.appender.IncomingRmiStats=wt.rmi.jmx.IncomingRmiStatsAppender # Disable IncomingRmiStats appender by default; set threshold to INFO to enable log4j.appender.IncomingRmiStats.threshold=WARN |
wt.log4j.jmx.IncomingRmiStatsAppender
# Configure IncomingRmiStats appender # Collects RMI statistics for viewing with wt.rmi.jmx.IncomingRmiStatsMonitor MBean; must instantiate this MBean (via MBean Loader) to access results appender.IncomingRmiStats.name=IncomingRmiStats appender.IncomingRmiStats.type=IncomingRmiStatsAppender # Disable IncomingRmiStats appender by default; set threshold to INFO to enable appender.IncomingRmiStats.filter.threshold.type=ThresholdFilter appender.IncomingRmiStats.filter.threshold.level=WARN |