The pre-requisite library required for the compilation of the Java Source is log4j.jar
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.
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.