Table of Contents
TABLE OF CONTENTS .....................................................................................................IV
FOREWORD........................................................................................................................... 7
PREFACE................................................................................................................................ 9
CONTENTS OF THIS BOOK...................................................................................................... 9
CONVENTIONS USED IN THIS BOOK.................................................................................... 10
COMMENTS AND QUESTIONS............................................................................................... 11
ACKNOWLEDGMENTS.......................................................................................................... 11
1. INTRODUCTION........................................................................................................ 13
INSTALLING ......................................................................................................................... 14
RUNNING THE EXAMPLES.................................................................................................... 14
FIRST BABY STEP ................................................................................................................ 15
RECIPE FOR USING LOG4J IN YOUR APPLICATIONS............................................................... 16
BUILDING LOG4J.................................................................................................................. 17
2. LOG4J ARCHITECTURE ......................................................................................... 19
LOGGER HIERARCHY ........................................................................................................... 19
LOGGER CREATION AND RETRIEVAL ................................................................................... 21
LEVELS................................................................................................................................22
LOGGER-LEVEL FILTER ....................................................................................................... 26
HIERARCHY-WIDE THRESHOLD FILTER............................................................................... 27
PRINTING EXCEPTIONS ........................................................................................................ 29
APPENDERS ......................................................................................................................... 30
LAYOUTS............................................................................................................................. 33
OBJECT RENDERING ............................................................................................................ 34
A PEEK UNDER THE HOOD................................................................................................... 35
LOGGINGEVENT CLASS ....................................................................................................... 36
PERFORMANCE .................................................................................................................... 37
3. CONFIGURATION SCRIPTS................................................................................... 43
SIMPLEST APPROACH USING BASICCONFIGURATOR............................................................ 43
SYNTAX OF CONFIGURATION FILES IN PROPERTIES FORMAT.............................................. 47
SETTING THE HIERARCHY-WIDE THRESHOLD ...................................................................... 52
SETTING THE LEVEL OF A LOGGER....................................................................................... 52
SETTING THE THRESHOLD OF AN APPENDER ....................................................................... 55
MULTIPLE APPENDERS......................................................................................................... 56
CONFIGURATION FILES IN XML .......................................................................................... 60
SYNTAX OF XML SCRIPTS................................................................................................... 61
SETTING A HIERARCHY-WIDE THRESHOLD (XML).............................................................. 68
SETTING THE LEVEL OF A LOGGER (XML) .......................................................................... 68
SETTING THE THRESHOLD OF AN APPENDER (XML)........................................................... 72