栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在Spring Boot中将特定的类记录到另一个日志文件中

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在Spring Boot中将特定的类记录到另一个日志文件中

如果需要这样做,则需要您自己的

logback.xml
文件。

<configuration><!-- Normal debug log appender -->  <appender name="FILE" >    <file>debug.log</file>    <enprer>      <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>    </enprer>  </appender><appender name="virtuallab" type="ch.qos.logback.core.rolling.RollingFileAppender">   <file value="Logs/virtuallab.log"/>   <appendToFile value="true"/>   <maxSizeRollBackups value="5"/>   <maximumFileSize value="5MB"/>   <rollingStyle value="Size"/>   <staticLogFileName value="true"/>   <enprer>     <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>   </enprer></appender><!-- Setup the root category, add the appenders and set the default level -->  <root level="debug">    <appender-ref ref="FILE" />  </root><!-- Specify the level specific to co.myapp.notifier --><logger name="co.myapp.notifier">  <level value="ALL" />  <appender-ref ref="virtuallab" /></logger></configuration>

如果需要控制台日志,则可能还需要添加它。这是文档,也请阅读此问题



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/670714.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号