Results 1 to 7 of 7

Thread: Spring with SLF4J

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    1

    Default Spring with SLF4J

    I want to use SLF4J for logging instead of commons-logging. How do I configure?

  2. #2
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    No way. Commons-logging is the only Spring hard dependency.
    To be more precious you may use SLF4J in your own code, but you still need commons-logging for Spring itself.

  3. #3
    Join Date
    Apr 2005
    Location
    Italy
    Posts
    95

    Default

    There is a way.

    You could always update the Spring source and recompile.

    With global search and replace this wouldn't be such a big deal.

  4. #4
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote Originally Posted by derek View Post
    There is a way.

    You could always update the Spring source and recompile.

    With global search and replace this wouldn't be such a big deal.
    Yes, if you will to do it with each new release.

  5. #5
    Join Date
    Dec 2005
    Posts
    935

    Default

    Just use the SLF4J jcl104-over-slf4j jar as a drop-in replacement for the commons-logging jar. With this you can get all the benefits of SLF4J and still use the exact same commons-logging API - ie no changes in your code.

    If you use Maven, the dependency is as follows:
    Code:
    <dependency>
    	<groupId>org.slf4j</groupId>
    	<artifactId>jcl104-over-slf4j</artifactId>
    	<version>1.4.2</version>
    </dependency>
    Alan

  6. #6
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    There is one problem - Spring relies on commons-logging 1.1, not 1.0.4,
    so I'm not sure that suggested drop-in would suffice.

    Regards,
    Oleksandr

    Quote Originally Posted by aks View Post
    Just use the SLF4J jcl104-over-slf4j jar as a drop-in replacement for the commons-logging jar. With this you can get all the benefits of SLF4J and still use the exact same commons-logging API - ie no changes in your code.

    If you use Maven, the dependency is as follows:
    Code:
    <dependency>
    	<groupId>org.slf4j</groupId>
    	<artifactId>jcl104-over-slf4j</artifactId>
    	<version>1.4.2</version>
    </dependency>
    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •