log4j

- A simple example of log4j
This Example shows you how to create a log in a program.
- log4j example
This Example shows you how to create a log in a Servlet.
- Use of BasicConfigurator in Log4j logging
In earlier example you have seen that we can define
properties of log4j logging file with the help of log4j.properties. Properties
can also be defined within log4j.xml file.
- log4j.xml Example
In earlier example you have seen that we can define
properties of log4j logging file with the help of log4j.properties. Properties
can also be defined within log4j.xml file.
- Console Appender in Log4j
In this log4j console appender tutorial you will be introduced with ConsoleAppender
which is used in Log4j for appending output on the console each and every time
when any info(), debug(), error() method is invoked by the
logger.
- FileAppender in Log4j
In previous section we have used ConsoleAppender
to append log events. We can also append these log events to a file by using FileAppender.
- WriterAppender in Log4j
In our previous section we have seen that we can append
log events in simple file (plain/text) file and to the console also. If we want
to write files then we have to use WriterAppender.
- Layouts in Log4j
Users more often wish to customize their output
according to their output format. Layout can be set by attaching it with the
appender. The Layout is responsible for formatting the logging output.
- Use of SimpleLayout in Log4j
In the previous example we have studied that there are
many Layout classes for displaying logging output in the desired format. In this
section we are going to describe you one of them, SimpleLayout, the
simplest of all.
- Use of XMLLayout in Log4j
In the previous sections we have used PatternLayout
and SimpleLayout, now we are going to describe you how to use XMLLayout
class to produce logging output in the XML format.
- TTCCLayout in Log4j
In the previous example we have studied that there are
many Layout classes for displaying logging output in the desired format.
- Use of HTMLLayout in Log4j
In this section we will describe you about HTMLLayout
class. This layout outputs events in a HTML table. Appenders using this layout
should have their encoding set to UTF-8 or UTF-16, otherwise events containing
non ASCII characters could result in corrupted log files.
-
A simple example of log4j for Servlet
This Example shows you how to create a log in a Servlet.

|