I\'m writing an application where I need to write log to a file using org.apache.commons.logging library, but i don\'t know how to start.
Can anyone hel
I hope this helps... this is how we have done in our project...
A. Include the jar in your project.
B. Define log4j.xml for loggers definition something like this...
C. Use the logger in the class:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Class YourClass{
private static Log log = LogFactory.getLog(YourClass.class);
public void yourMethod(){
log.info("Your Message");
}
}
EDIT: D. Since we have a JBoss AS environment so the application is configured to read log4j.xml like following (You would need an equivalent config):
resource:jboss-log4j.xml
true
60