开发者

what is debug logging in spring MVC

My spring MVC is not working and i am getting error resource not found.

I have heard about debug logging.

Is it something that i can turn on and i can see more detail that where is the problem or

is it something i need to program in every file开发者_开发问答 only that message will be shown which i hard coded in file


Spring uses the Apache Commons Logging API, which in turn uses either internal Java logging, or log4j (if available). See this part of the docs for a fuller explanation.

"debug logging" refers to the fact that Spring does a lot of verbose logging at "debug level", which is normally not recorded. You can reconfigure your logging, however, to show this level of information if required. Again, see the above link.


In your log4j.properties, set the logging level for Spring to DEBUG, something along the lines of

log4j.logger.org.springframework = DEBUG, <Some appender>


From a personal blog post, the required maven dependencies are:

<properties>
    ...
    <spring.version>3.1.2.RELEASE</spring.version>
    <slf4j.version>1.7.1</slf4j.version>
    <logback.version>0.9.30</logback.version>
</properties>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${spring.version}</version>
    <exclusions>
        <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </exclusion>
    </exclusions>
    <type>jar</type>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>${slf4j.version}</version>
    <scope>runtime</scope>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>${slf4j.version}</version>
    <type>jar</type>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>${logback.version}</version>
</dependency>

The above enables Logback. Check the corresponding documentation to set the desired logging level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜