ii TABLE OF CONTENTS
DEFAULT INITIALIZATION .................................................................................................... 66
LOG4J INITIALIZATION IN WEB CONTAINERS ...................................................................... 69
DEFAULT INITIALIZATION UNDER TOMCAT ......................................................................... 70
INITIALIZATION SERVLET ..................................................................................................... 71
LOG4J INITIALIZATION IN APPLICATION SERVERS ............................................................... 72
4. APPENDERS ................................................................................................................. 75
APPENDERSKELETON ........................................................................................................... 76
WRITERAPPENDER ............................................................................................................... 79
CONSOLEAPPENDER ............................................................................................................. 82
FILEAPPENDER ..................................................................................................................... 83
ROLLINGFILEAPPENDER ...................................................................................................... 84
DAILYROLLINGFILEAPPENDER............................................................................................ 86
SOCKETAPPENDER ............................................................................................................... 88
JMSAPPENDER ..................................................................................................................... 91
SMTPAPPENDER................................................................................................................ 101
ASYNCAPPENDER............................................................................................................... 105
HANDLING ERRORS ............................................................................................................ 108
WRITING YOUR OWN APPENDER ........................................................................................ 110
5. LAYOUT...................................................................................................................... 113
WRITING YOUR OWN LAYOUT ............................................................................................ 113
PATTERNLAYOUT............................................................................................................... 116
XMLLAYOUT..................................................................................................................... 120
HTMLLAYOUT .................................................................................................................. 121
6. CUSTOM FILTERS ................................................................................................... 123
WRITING YOUR OWN FILTER............................................................................................... 126
7. DIAGNOSTIC CONTEXTS ...................................................................................... 128
MAPPED DIAGNOSTIC CONTEXTS ...................................................................................... 128
NESTED DIAGNOSTIC CONTEXTS ....................................................................................... 135
8. EXTENDING LOG4J................................................................................................. 138
WRITING YOUR OWN LEVELS ............................................................................................. 139
WRITING YOUR OWN LOGGER CLASS ................................................................................. 143
WRAPPING THE LOGGER CLASS.......................................................................................... 144
THE WIDER CONTEXT ......................................................................................................... 153
9. CHANGES ................................................................................................................... 163
BETWEEN LOG4J VERSION 1.1.X AND 1.2 ........................................................................... 163
LOGGER REPLACES CATEGORY .......................................................................................... 163
COMPATIBILITY ISSUES WITH CATEGORY SUB-CLASSES .................................................... 164
LEVEL REPLACES PRIORITY................................................................................................ 164
10. FREQUENTLY ASKED QUESTIONS ............................................................... 166