Skip to Content
Logging has become an important feature of any application that is being developed to keep track of the bugs and view information in the project.

Pre-requisite:

The pre-requisite library required for the compilation of the Java Source is log4j.jar

Code Sample:

The code sample for the application to write into the log file is as follows. The properties file for the application is placed in the properties folder in the WEB-INF directory of the application. The object is passed to keep note of the class which called upon the logger in the log file.

Properties File:

The name and type of the file appender is specified in the properties file along with the conversion pattern and the layout. We can use INFO, ERROR, DEBUG, WARN and FATAL to display the messages to the user. When the option is specified as INFO all the messages will be displayed irrespective of the level.


The custom log file is placed under the default log folder for easy reference.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply