/*
The Log being used >>> org.apache.commons.logging.impl.Jdk14Logger@a97b0b
Jun 10, 2006 1:37:28 PM LoggingTrial main
INFO: INFO TEST
Jun 10, 2006 1:37:29 PM LoggingTrial main
INFO: INFO TEST
java.lang.Exception: A DUMMY EXCEPTION
at LoggingTrial.main(LoggingTrial.java:9)
Jun 10, 2006 1:37:29 PM LoggingTrial main
WARNING: WARN TEST
Jun 10, 2006 1:37:29 PM LoggingTrial main
WARNING: WARN TEST
java.lang.Exception: A DUMMY EXCEPTION
at LoggingTrial.main(LoggingTrial.java:9)
Jun 10, 2006 1:37:29 PM LoggingTrial main
SEVERE: ERROR TEST
Jun 10, 2006 1:37:29 PM LoggingTrial main
SEVERE: ERROR TEST
java.lang.Exception: A DUMMY EXCEPTION
at LoggingTrial.main(LoggingTrial.java:9)
Jun 10, 2006 1:37:29 PM LoggingTrial main
SEVERE: FATAL TEST
Jun 10, 2006 1:37:29 PM LoggingTrial main
SEVERE: FATAL TEST
java.lang.Exception: A DUMMY EXCEPTION
at LoggingTrial.main(LoggingTrial.java:9)
*/
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class LoggingTrial {
public static void main(String[] args) {
Log log = LogFactory.getLog(LoggingTrial.class);
System.out.println("The Log being used >>> " + log);
Exception e = new Exception("A DUMMY EXCEPTION");
if (log.isTraceEnabled()) {
log.trace("TRACE TEST");
log.trace("TRACE TEST", e);
}
if (log.isDebugEnabled()) {
log.debug("DEBUG TEST");
log.debug("DEBUG TEST", e);
}
if (log.isInfoEnabled()) {
log.info("INFO TEST");
log.info("INFO TEST", e);
}
if (log.isWarnEnabled()) {
log.warn("WARN TEST");
log.warn("WARN TEST", e);
}
if (log.isErrorEnabled()) {
log.error("ERROR TEST");
log.error("ERROR TEST", e);
}
if (log.isFatalEnabled()) {
log.fatal("FATAL TEST");
log.fatal("FATAL TEST", e);
}
}
}
Apache-Common-Lang.zip( 248 k)