lx.lxboot3.1.0.source-code.logback-spring.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lxboot3 Show documentation
Show all versions of lxboot3 Show documentation
使用文档: https://a7fi97h1rc.feishu.cn/docx/X3LRdtLhkoXQ8hxgXDQc2CLOnEg?from=from_copylink
<?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <springProperty scop="context" name="appName" source="spring.application.name" defaultValue="lxlog"/> <!--控制台日志, 控制台输出 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度,%msg:日志消息,%n是换行符--> <pattern>[%date{ISO8601}] [%X{requestId}] [%-5level] [%thread] [%logger] - %msg %rootException %n</pattern> </encoder> </appender> <!--文件输出,时间窗口滚动--> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!--日志名,指定最新的文件名,其他文件名使用FileNamePattern --> <File>./logs/${appName}/out.log</File> <!--文件滚动模式--> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名,可设置文件类型为gz,开启文件压缩--> <FileNamePattern>./logs/${appName}/%d{yyyy-MM-dd}.%i.log.gz</FileNamePattern> <!--日志文件保留天数--> <MaxHistory>7</MaxHistory> <!--按大小分割同一天的--> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>10MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <!--输出格式--> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>[%date{ISO8601}] [%X{requestId}] [%-5level] [%thread] [%logger] - %msg %rootException %n</pattern> <!--设置编码--> <charset>UTF-8</charset> </encoder> </appender> <appender name="lxlog" class="com.lx.boot.log.LXLogAppender"></appender> <logger name="logging.level.mapper" level="DEBUG"/> <logger name="com.apache.ibatis" level="TRACE"/> <logger name="java.sql.Connection" level="DEBUG"/> <logger name="java.sql.Statement" level="DEBUG"/> <logger name="java.sql.PreparedStatement" level="DEBUG"/> <logger name="org.elasticsearch.client.RestClient" level="ERROR"/> <!-- 日志输出级别 --> <root level="info"> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE"/> <appender-ref ref="lxlog" /> </root> </configuration>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy