I am having the below simple code. I am trying to use apache-commons+log4j since spring WS expects the apache commons to be used.
But I am not getting any thing printed. Please let me know what am i missing here.
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
//Import log4j classes.
public class MyApp {
// Define a static logger variable so that it references the
// Logger instance named "MyApp".
private static final Log logger = LogFactory.getLog(MyApp.class);
public static void main(final String... args) {
// Set up a simple configuration that logs on the console.
logger.info("Entering application.");
//some stuff here
logger.trace("Exiting application.");
}
}
commons-logging.properties:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4jLogger
log4j.configuration=log4j.properties
log4j.properties:
log4j.rootCategory=INFO, stdout, TRACE
log4j.logger.org.springframework.ws.client.MessageTracing.sent=TRACE
log4j.logger.org.springframework.ws.client.MessageTracing.received=TRACE
log4j.logger.org.springframework.ws.server.MessageTracing=DEBUG
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n
Additionally I am getting below error message in console. I am wondering as I have not configured anything with slf4j
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.