Question

I am using this setup:

Spring Tool Suite

Version: 3.5.0.RELEASE Build Id: 201404011654 ​JAVA 1.7.51

I am developing a Spring project and everything is working fine. I have standard configurations for logging. But if I run my project on my tomcat in the IDE it logs everything. Including all JARs which I am using. Doesn't matter if it is Hibernate / Spring / Apache CFX or Standard TLS Debug outputs. Everthing is written in the console :(

for example:

496130 [pool-1-thread-1] DEBUG org.apache.cxf.phase.PhaseInterceptorChain  - Invoking handleMessage 
496139 [pool-1-thread-1] DEBUG org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction  - disabling autocommit

Here is my logback:

<?xml version="1.0" encoding="UTF-8"?>
<!-- configuration file for LogBack (slf4J implementation)>
<configuration scan="true" scanPeriod="30 seconds">

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
    <resetJUL>true</resetJUL>
</contextListener>

<!-- To enable JMX Management -->
<jmxConfigurator/>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>%-5level %logger{0} - %msg%n</pattern>
    </encoder>
</appender>

<!--<logger name="org.hibernate" level="debug"/> -->
<!-- Uncomment and add your logger here:
<logger name="org.springframework.samples.service.service" level="debug"/> -->

<root level="info">
    <appender-ref ref="console"/>
</root>

Maybe someone can help me!

Thanks a lot!

Was it helpful?

Solution

This can be due to the fact that logback cannot find config file in classpath. I've just make a test, renaming logback.xml into _logback.xml. It logs everything!

Check that logback.xml file is in your classpath and that is named correctly.

You can put it into META-INF for example (this is my case).

I have found also this sequence:

  1. Logback tries to find a file called logback.groovy in the classpath.
  2. If no such file is found, logback tries to find a file called logback-test.xml in the classpath.
  3. If no such file is found, it checks for the file logback.xml in the classpath..
  4. If neither file is found, logback configures itself automatically using the BasicConfigurator which will cause logging output to be directed to the console.

hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top