Reference to log4j.xml broken after maven dependency spring-data-rest-webmvc, packages abbreviated

StackOverflow https://stackoverflow.com/questions/14583403

Pregunta

I have a problem with my (java) Spring 3 project:

I've included a maven dependency to "spring-data-rest-webmvc" (version 1 through 1.0.0-RC3) where the standard log4j.xml is not used anymore. Instead it appears some other properties logging file is used (which I cannot find), not in my package nor in the spring-data-rest-webmvc source.

Together with the logging link problem, the package names are all abbreviated, which I think is odd (unexpected at least).

I do want to use this Spring package to, easily, create restful web-services.

I want control over my log4j properties file, while using the spring package. Btw, it appears that three logging systems are used (log4j, slf4j, and commons-logging), shouldn't be a problem, right?

¿Fue útil?

Solución

Difficult to tell without code, but what most likely has happened is that your project has become dependent on logback-classic when you added the spring-data-rest-webmvc dependency.

If you put the file logback.xml with the following content next to you log4j.xml, log4j will be picked up again.

<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
        </pattern>
    </encoder>
</appender>
<logger name="org.springframework.data.rest" level="INFO" />
<root level="INFO">
    <appender-ref ref="stdout" />
</root>
</configuration>

Otros consejos

Alternatively, to get rid of this DEBUG-level output just exclude logback dependency. In maven it'll be:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-rest-webmvc</artifactId>
    <exclusion>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
    </exclusion>
</dependency>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top