Where Log Entries Go
Appenders determine where log entries go:
•Transcript
•Console
•File
•Socket
Appenders usually log synchronously. Asynchronous appenders have the same ini values in the same order as their synchronous brethren, but have the name of the EsAsyncAppender they are attached to as the last parameter.
transcriptAppender
Syntax: transcriptAppender=someCaseSensitiveLoggerName, levelName, patternLayout, patternString
Example: transcriptAppender=root, All, EsPatternLayout, '%-15d %c %-5p %16m'
The name of the transcriptAppender is 'Transcript'. There is only one transcriptAppender.
consoleAppender
Syntax: consoleAppender=someCaseSensitiveLoggerName, levelName, patternLayout, patternString
Example: consoleAppender=root, All, EsPatternLayout, '%-15d %c %-5p %16m'
The name of the consoleAppender is 'Console'. There is only one consoleAppender.
asyncConsoleAppender
Syntax: asyncConsoleAppender =someCaseSensitiveLoggerName, levelName, patternLayout, patternString, someCaseSensitiveAsyncAppenderName
Example: asyncConsoleAppender =root, All, EsPatternLayout, '%-15d %c %-5p %16m', Vast
fileAppender
Syntax: fileAppender=someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean
Example: fileAppender=TestRollingFileAppender, root, \temp\log4s.log, false, Error, EsPatternLayout, '%r %m', true,
asyncFileAppender
Syntax: asyncFileAppender =someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean, someCaseSensitiveAsyncAppenderName
Example: asyncFileAppender =TestRollingFileAppender, root, \temp\log4s.log, false, Error, EsPatternLayout, '%r %m', true, Vast
rollingFileAppender
Syntax: rollingFileAppender=someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean, maxFileSize, maxBackupIndex
Example: rollingFileAppender=TestRollingFileAppender, root, \temp\rollLog4s.log, false, Error, EsPatternLayout, '%r %m', true, 500, 5
The rollingFileAppender will write initially to the file specified in the fileName value. The rollingFileAppender will check its size after each time it logs a logging Event. If the new size exceeds the maxFileSize value, the rollingFileAppender will then close that file, and open a new one with an integer appended to the original file name. It will repeat this process maxBackupIndex number of times, and then start overwriting the original file name.
For example, if the original file name is rollLog4s.log, then the rollingFileAppender will write initially to rollLog4s.log, then to rollLog4s.log1, rollLog4s.log2 through rollLog4s.log5, and then write over rollLog4s.log.
asyncRollingFileAppender
Syntax: asyncRollingFileAppender =someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean, maxFileSize, maxBackupIndex, someCaseSensitiveAsyncAppenderName
Example: asyncRollingFileAppender =TestRollingFileAppender, root, \temp\rollLog4s.log, false, Error, EsPatternLayout, '%r %m', true, 500, 5, Vast
dailyRollingFileAppender
Syntax: dailyRollingFileAppender=someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean, whenToRoll
Example: dailyRollingFileAppender =TestRollingFileAppender, root, \temp\dailyRollLog4s.log, false, Error, EsPatternLayout, '%r %m', true, topOfMinute
The dailyRollingFileAppender will write initially to the file specified in the fileName value. When it starts, the dailyRollingFileAppender will calculate the time and date that it should rollover or start a new file. This calculation is done based on what is specified in the whenToRoll value.
| | |
topOfMinute | every minute | dailyRollLog4s.log.2011-08-17-11-17 |
topOfHour | every hour | dailyRollLog4s.log.2011-08-17-12 |
halfDay | midnight and noon | dailyRollLog4s.log.2011-08-17-pm |
topOfDay | every midnight | dailyRollLog4s.log.2011-08-18 |
topOfWeek | every Sunday 00:00:00,001 | dailyRollLog4s.log.2011-Sun |
topOfMonth | 00:00:00,001 the first of each month | dailyRollLog4s.log.2011-09 |
asyncDailyRollingFileAppender
Syntax: asyncDailyRollingFileAppender =someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, fileName, fileAppendBoolean, levelName, patternLayout, patternString, immediateFlushBoolean, whenToRoll, someCaseSensitiveAsyncAppenderName
Example: asyncDailyRollingFileAppender =TestRollingFileAppender, root, \temp\dailyRollLog4s.log, false, Error, EsPatternLayout, '%r %m', true, topOfMinute, Vast
socketAppender
Syntax: socketAppender=someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, levelName, patternLayout, patternString, ipAddress, hostName, port, retryCount, retrySeconds
Example: socketAppender=TestSocketAppender, root, All, EsPatternLayout, '%m %c', '127.0.0.1', localHost, 4433, 99, 30
The socketAppender should specify either ipAddress or hostName; if both are specified, then the ipAddress will be used. The ipAddress should be surrounded by single quotes. The listener should be running when the socketAppender starts or it will fail. If the socketAppender fails, it will try to connect retryCount number of times after waiting retrySeconds between attempts.
asyncSocketAppender
Syntax: asyncSocketAppender =someCaseSensitiveAppenderName, someCaseSensitiveLoggerName, levelName, patternLayout, patternString, ipAddress, hostName, port, retryCount, retrySeconds, someCaseSensitiveAsyncAppenderName
Example: asyncSocketAppender =TestSocketAppender, root, All, EsPatternLayout, '%m %c', '127.0.0.1', localHost, 4433, 99, 30, Vast