[slf4j-user] How to debug sl4j

Ceki Gulcu listid at qos.ch
Thu Oct 23 10:53:15 CEST 2008


Hello Farrukh,

I might be simply that Maven is not handing the right the dependencies to 
surefire... Which version of Maven are you using?

Farrukh Najmi wrote:
> It appears that my immediate problem was solved when I specified 
> -DforkMode=none to maven-sure-fire-plugin's test goal:
> 
> mvn test -DforkMode=none -Dtest=MyTestClass
> 
> Now I see debug messages from Hibernate. So this *does* seem to be some 
> sort of classloader issue.
> 
> It does make me curious why using jcl-over-slf4j did not fix the 
> problem. Any ideas?
> 
> Farrukh Najmi wrote:
>> Hello,
>>
>> My project currently uses JCL. I have this strange problem where I can 
>> control log4j messages for hibernate via log4j.properties
>> in my deployed servlet but cannot do the same for my junit tests that 
>> run via maven-surefire-plugin.
>>
>> Reading up I learned about JCLs extreme vulnerability to classloader 
>> hacks and how it can behave oddly under different classloader situations.
>> So I decided to give slj4j a try.
>>
>> I followed instruction for gradual migration here:
>>
>> <http://www.slf4j.org/legacy.html#jcl-over-slf4j>
>>
>> In my modules pom I added the following dependencies:
>>
>>     <dependency>
>>       <groupId>org.slf4j</groupId>
>>       <artifactId>slf4j-api</artifactId>
>>       <version>1.5.5</version>
>>     </dependency>
>>     <dependency>
>>       <groupId>org.slf4j</groupId>
>>       <artifactId>slf4j-log4j12</artifactId>
>>       <version>1.5.5</version>
>>     </dependency>
>>     <dependency>
>>       <groupId>org.slf4j</groupId>
>>       <artifactId>jcl-over-slf4j</artifactId>
>>       <version>1.5.5</version>
>>     </dependency>    
>>
>> The good thing is that I now seem to get exactly the same log output 
>> that I did before.
>> However, I was expecting the missing hibernate log messages to start 
>> appearing but they
>> did not.
>>
>> I had assumed that since the same log4j.properties file works in the 
>> servlet but does not work
>> in the junit test that the problem must be classloader related and that 
>> using sl4j would fix it.
>>
>> I did not get the anticipated joy.
>>
>> Would a kind soul guide me as to what I should try next?
>>
>> TIA for your help.
>>
>>   
> 
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list