cvc-elt.1: Cannot find the declaration of element 'configuration'

时间:2016-03-02 10:51:54

标签: xml logback

I want to use Logback in my Web Project,but in logback.xml there is a problem:

cvc-elt.1: Cannot find the declaration of element 'configuration'.

Here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <property name="USER_HOME" value="logs" />
    <property scope="context" name="FILE_NAME" value="mylog-logback" />

    <timestamp key="byDay" datePattern="yyyy-MM-dd" />

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>
    </appender>

    <appender name="file"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${USER_HOME}/${FILE_NAME}.log</file>

        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>${USER_HOME}/${byDay}/${FILE_NAME}-${byDay}-%i.log.zip
            </fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>10</maxIndex>
        </rollingPolicy>

        <triggeringPolicy
            class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>5MB</maxFileSize>
        </triggeringPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>

    </appender>

    <logger name="com.linkcos.object.*" level="track" additivity="false">
        <appender-ref ref="file" />
        <!-- <appender-ref ref="STDOUT" /> -->
    </logger>

    <root level="info">
        <appender-ref ref="file" />
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

This is really a strange question,please help me!

1 个答案:

答案 0 :(得分:0)

请勿将logback.xml导入Spring应用程序。