Como configuro o Spring e o SLF4J para que eu possa obter o log?

Eu tenho um aplicativo maven & spring no qual quero fazer login. Estou interessado em usar o SLF4J.

Desejo colocar todos os meus arquivos de configuração em um diretório {classpath} / config, incluindo log4j.xml, e depois iniciar usando um spring bean.

por exemplo.

<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass" value="org.springframework.util.Log4jConfigurer"/>
    <property name="targetMethod" value="initLogging"/>
    <property name="arguments">
        <list>
            <value>classpath:config/log4j.xml</value>
        </list>
    </property>
</bean>

No entanto, recebo esse aviso e nenhum log.

log4j: WARN Não foram encontrados anexos para o criador de logs (org.springframework.context.support.ClassPathXmlApplicationContext). log4j: WARN Inicialize o sistema log4j corretamente. log4j: WARN Consultehttp://logging.apache.org/log4j/1.2/faq.html#noconfig para mais informações.

Pesquisei no Google e não consigo encontrar um exemplo simples de como configurar isso. Alguma ideia?

questionAnswers(6)

yourAnswerToTheQuestion