Spring Logging - Log4J
by, 07-07-2012 at 07:39 PM (2177 Views)
The Spring framework has great support for Log4J and it is easy to use Log4J for logging inside Spring applications. In this section, we will discuss the Log4J and Spring integration and how you can use it.
To install the Log4J on you machine, download it from the apache website, extract the zip file and use the log4j.jar in your project.
The Jakarta commons loggin (JCL) API provides an alternative approach to support loggin in your Spring application. Jakarta commons loggin API can be downloaded from the jakarta website. The commons-logging.jar is the only file which is required technically. You will place this jar file into your class path same as you have placed the log4j.jar.
The org.apache.commons.logging object is required to use the logging. One of the below given methods are called according to your requirements.
• warn(Object message)
• error(Object message
• fatal(Object message
• info(Object message
• trace(Object message
• debug(Object message