[slf4j-user] blog entry on JCL

Matt Raible mraible at gmail.com
Mon Feb 5 21:25:11 CET 2007


Thanks - that works!  However, I'd expect the logging to look the same
as it did before.  Unfortunately, it looks like the method isn't
printed out - just "info", "debug", etc.  Here's my log4j.xml
configuration:

    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="%p [%t] %c{1}.%M(%L) | %m%n"/>
        </layout>
    </appender>

commons-logging:

WARN [main] UserAction.save(157) | User 'tomcat' already exists!
INFO [main] UserActionTest.endTransaction(284) | Rolled back
transaction after test execution
INFO [main] UserActionTest.startNewTransaction(318) | Began
transaction (1): transaction manager
[org.springframework.orm.hibernate3.HibernateTransactionManager at 77cd4a];
default rollback = true
INFO [main] UserActionTest.endTransaction(284) | Rolled back
transaction after test execution
INFO [main] UserActionTest.startNewTransaction(318) | Began
transaction (1): transaction manager
[org.springframework.orm.hibernate3.HibernateTransactionManager at 77cd4a];
default rollback = true
DEBUG [main] UserManagerImpl.removeUser(66) | removing user: 2
INFO [main] UserActionTest.endTransaction(284) | Rolled back
transaction after test execution

SLF4J:

WARN [main] UserAction.warn(139) | User 'tomcat' already exists!
INFO [main] UserActionTest.info(118) | Rolled back transaction after
test execution
INFO [main] UserActionTest.info(118) | Began transaction (1):
transaction manager
[org.springframework.orm.hibernate3.HibernateTransactionManager at f4b30a];
default rollback = true
INFO [main] UserActionTest.info(118) | Rolled back transaction after
test execution
INFO [main] UserActionTest.info(118) | Began transaction (1):
transaction manager
[org.springframework.orm.hibernate3.HibernateTransactionManager at f4b30a];
default rollback = true
DEBUG [main] UserManagerImpl.debug(97) | removing user: 2
INFO [main] UserActionTest.info(118) | Rolled back transaction after
test execution

Thanks,

Matt

On 2/5/07, Ceki Gülcü <listid at qos.ch> wrote:
> The slf4j bindings are not cumulative. You cannot use both the
> slf4j-simple binding and the slf4j-log4j binding, chose one or the other.
>
> If you wish to use log4j, your dependency list should read:
>
>           <dependency>
>               <groupId>org.slf4j</groupId>
>               <artifactId>jcl104-over-slf4j</artifactId>
>               <version>${slf4j.version}</version>
>           </dependency>
>           <dependency>
>               <groupId>org.slf4j</groupId>
>               <artifactId>slf4j-log4j12</artifactId>
>               <version>${slf4j.version}</version>
>           </dependency>
>
> HTH
>
>  > On Mon, 5 Feb 2007 12:36:46 -0700, Matt Raible wrote:
>  >
>  > OK, adding sjf4j-simple as a dependency allows the plugin to work.  I
>  > added the following 3 dependencies:
>  >
>  >
>  >         <dependency>
>  >             <groupId>org.slf4j</groupId>
>  >             <artifactId>jcl104-over-slf4j</artifactId>
>  >             <version>${slf4j.version}</version>
>  >         </dependency>
>  >         <dependency>
>  >             <groupId>org.slf4j</groupId>
>  >             <artifactId>slf4j-simple</artifactId>
>  >             <version>${slf4j.version}</version>
>  >         </dependency>
>  >         <dependency>
>  >             <groupId>org.slf4j</groupId>
>  >             <artifactId>slf4j-log4j12</artifactId>
>  >             <version>${slf4j.version}</version>
>  >         </dependency>
>  >
>  >
>  > However, with commons-logging, my log4j.xml (in src/test/resources)
>  > was picked up and used automatically.  This doesn't seem to be
>  > happening with slf4j.
>  >
>  >
>  > Thanks,
>
>  > Matt
>
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for Java.
> http://logback.qos.ch
>
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user
>


-- 
http://raibledesigns.com


More information about the slf4j-user mailing list