总感觉我的logback配置文件有问题
<?xml version="1.0" encoding="UTF-8"?> <!-- 日志管理 --> <configuration> <property name="logDir" value="../logs" /> <!-- 日志写到控制台中 --> <appender name="A1" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%date %-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80}- %msg%n</Pattern> <charset>UTF-8</charset> </layout> </appender> <!-- 日志写到文件中 --> <appender name="C" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logDir}/magvacations.log</file> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} -%msg%n</Pattern> <charset>UTF-8</charset> </layout> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern> ${logDir}/magvacations.%d{yyyy-MM-dd}.log </FileNamePattern> <maxHistory>15</maxHistory> </rollingPolicy> <!-- 如果超过100MB就删除 --> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> </appender> <!-- 具体包和类 日志级别 --> <logger name="org.springframework" level="ERROR" /> <logger name="org.quartz" level="INFO" /> <logger name="net.sf.ehcache.hibernate" level="ERROR" /> <logger name="org.hibernate" level="ERROR" /> <logger name="org.apache.struts2" level="ERROR" /> <logger name="com.opensymphony.xwork2" level="ERROR" /> <logger name="com.xsw.admin.sanpin" level="info" additivity="false"> <appender-ref ref="C" /> </logger> <logger name="com.xsw.admin.team" level="info" additivity="false"> <appender-ref ref="C" /> </logger> <logger name="com.xsw.report.current.action" level="info" additivity="false"> <appender-ref ref="C" /> </logger> <root level="error"> <appender-ref ref="A1" /> <appender-ref ref="C" /> </root> </configuration>
本文地址: https://www.xiongge.club/biancheng/java/1226.html
转载请注明:熊哥club → logback.xml配置文件logback日志记录框架
©熊哥club,本站推荐使用的主机:阿里云,CDN建议使用七牛云。
关注微信公众号『熊哥club』
免费提供IT技术指导交流
关注博主不迷路~