我有一个Spring项目,该 logback.xml:部署在WebLogic Server版本:12.2.1.0.0中,并且在weblogic控制台中看不到任何错误,我还看到了消息,但未生成日志文件
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %-5level [%thread] %logger{36}:%line - %msg%throwable%n</pattern>
</encoder>
</appender>
<appender name="rollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>C:/Work/logs/guerrilla.log</file>
<!-- file>servers/${weblogic.Name}/logs/guerrilla.log</file-->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>servers/${weblogic.Name}/logs/%d{yyyy,aux}/%d{MM,aux}/guerrilla.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %-5level [%thread] %logger{36}:%line - %msg%throwable%n</pattern>
</encoder>
</appender>
<logger name="eu.europa" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="rollingFileAppender"/>
<appender-ref ref="consoleAppender"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="consoleAppender"/>
</root>
并且我在WL控制台中看到此消息:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
我在pom.xml中有这个
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>