slf4j « Development « Spring Q&A





1. Spring constructor injection of SLF4J logger - how to get injection target class?    stackoverflow.com

I'm trying to use Spring to inject a SLF4J logger into a class like so:

@Component
public class Example {

  private final Logger logger;

  @Autowired
  public Example(final Logger logger) {
 ...

2. removing commons-logging and using slf4j causes errors in spring    stackoverflow.com

Specifically, I use spring only for configuring my project through ApplicationContext. In my spring xml I load some bean properties through PropertyPlaceholderConfigurer. Whenever in the dependencies I swap commons-logging-x.x with jcl-slf4j.jar ...

3. How do I configure Spring and SLF4J so that I can get logging?    stackoverflow.com

I've got a maven & spring app that I want logging in. I'm keen to use SLF4J. I want to put all my config files into a directory {classpath}/config including log4j.xml and ...

4. using slf4j to log in spring when I can't get rid of commons-logging    stackoverflow.com

I'm using some a component other than Spring that has a commons-logging dependency. So, excluding commons-logging from the spring dependency doesn't get rid of it, and so the instructions here ...

5. what's wrong for this error    stackoverflow.com

Spring framework throws

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
    at org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:454)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:392)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
what's the reason?

6. How to use SLF4J to log to two different files based on type of msg..?    stackoverflow.com

i am running a client server program in spring. i am trying to implement SLF4J + Logback for logging. Now the thing is my client (which in real life would be a device/sensor) ...

7. Using Spring to inject different instances of a class based on instantiation hierarchy    stackoverflow.com

I have a class structure along these lines:

public class Worker {
    private Parser parser;
    private Validator validator;
    private Feeder feeder;

   ...

8. slf4j and jsr303 validation conflict    forum.springsource.org

slf4j and jsr303 validation conflict Hello, I've some problems with hibernate-validation 4.1. I've change pom dependency from hibernate-validation 4.0.1 to 4.1 and now I cant start my application on glassfish 3.0.1 ...

9. please explain me your slf4j strategy / IMO its flawed    forum.springsource.org

please explain me your slf4j strategy / IMO its flawed Hi, perhaps i misunderstand how slf4j works but including Spring Data JPA broke my complete application logging. As far as i ...





10. Spring with SLF4J    forum.springsource.org

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.

11. Is slf4j required by spring-core?    forum.springsource.org

Is slf4j required by spring-core? We are evaluating an upgrade from Spring 2.5.4 to 2.5.6; while most of the dependencies have just been upgraded, I noticed that slf4j/slf4j-log4j were introduced in ...

12. Upgrading SLF4J from 1.5.0 to 1.5.6    forum.springsource.org

Upgrading SLF4J from 1.5.0 to 1.5.6 Because the Hibernate 3.3.x bundle's (I think I recall that being the Hibernate bundle - at least it is one of Hibernate bundles) dependency on ...

13. Can't validate import of org.slf4j using dm Server 2.0 targeted runtime    forum.springsource.org

I'm having trouble validating the import of package org.slf4j in one of my bundles even though my bundle project references a dm Server 2.0 targeted runtime (using STS 2.1.0.M1). Please see ...

14. SLF4J LoggerFactory in Spring 3.0    forum.springsource.org

SLF4J LoggerFactory in Spring 3.0 As soon as use the AnnotationConfig class with Spring I get this: [WARN] Nested in org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'hibernateSessionFactory' defined in ServletContext ...

15. Replacing apache commons logging with slf4j    forum.springsource.org

Are there any plans to replace apache commons logging with slf4j throughout the spring framework? I'm kind of surprised commons logging is still in use to be honest given the fact ...

16. Switching jcl to jcl-slf4j causes placeholder configurer to stop working    forum.springsource.org

Switching jcl to jcl-slf4j causes placeholder configurer to stop working Specifically, I use spring only for configuring my project through ApplicationContext. In my spring xml I load some bean properties through ...





17. log4j, slf4j, commons_logging    forum.springsource.org

log4j, slf4j, commons_logging Hello, Im using Spring, Spring Security and Hibernate in a small webapplication. Im really new to this all. I have a newbie question and I hope you can ...