Reputation: 501
I have a WebApp that I develop using NetBeans 7.4. I deploy it on a Linux server running Tomcat 7.0.47.
I am trying to have a decent logging mechanism with slf4j and logback.
My project uses the following jars:
My app is a SOAP server. At the head of the service class I put:
private static final String nameOfLogger = MatrixSoapService.class.getName();
private static final Logger soapLogger = LoggerFactory.getLogger(nameOfLogger);
then when I need to log something:
soapLogger.info("Init");
etc...
Ok. That's for the context.
My question is: how do I configure this to have rolling logs in my $CATALINE_HOME/conf folder for this application?
I thought I only needed to create a simple logback.xml file in the src folder of my webapp like this, but to no avail. I have no log generated.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>mySOAP - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="com.xxx" level="TRACE"/>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
Upvotes: 4
Views: 6283
Reputation: 501
The main issue was that the location of that file was wrong. I put it now in
/webapps/your-app/WEB-INF/classes/
and at least the content of that logback.xml is used
Upvotes: 3