备忘录三:春天+德鲁伊+ log4j2引导

  

  <强>   一:砰的一声。xml配置:去掉弹簧引导默认的spring-boot-starter-logging,引入spring-boot-starter-log4j2      

  <前>   & lt; dependency>   & lt; groupId> org.springframework.boot   & lt; artifactId> spring-boot-starter-web   & lt; exclusions>   & lt; exclusion>   & lt; groupId> org.springframework.boot   & lt; artifactId> spring-boot-starter-logging   & lt;/exclusion>   & lt;/exclusions>   & lt;/dependency>   & lt; dependency>   & lt; groupId> org.springframework.boot   & lt; artifactId> spring-boot-starter-log4j2   & lt;/dependency>   之前   

  
  

  

  <强>   二:应用配置application.yaml      

  <前>   #,日志   日志:   配置:才能类路径:log4j2.xml   之前   

  <强>   三:log42j.xml配置      

  <前>   & lt; ? xml  version=?.0“,编码=癠TF-8" ?比;   & lt; Configuration 状态=癘FF"祝辞   & lt; Properties>   & lt; property  name=癓OG_HOME"祝辞D:/logs   & lt;/Properties>   & lt; Appenders>   & lt; Console  name=癱onsole",目标=癝YSTEM_OUT", immediateFlush=皌rue"比;   & lt; ThresholdFilter 水平=癲ebug", onMatch=癆CCEPT"   onMismatch=癉ENY",/比;   & lt; PatternLayout 模式=癧% 5 p], [% d {yyyy-MM-dd  HH: mm: ss 瑞士}),% c 作用;% m % n",/比;   & lt;/Console>   & lt; RollingRandomAccessFile  name=癷nfoLog"   immediateFlush=皌rue",文件名=? {LOG_HOME}/infoService.log"   filePattern=? {LOG_HOME}/{yyyy-MM-dd} .log.gz" infoService.log. % d;比;   & lt; PatternLayout>   & lt; pattern> [% 5 p], [% d {yyyy-MM-dd  HH: mm: ss 瑞士}),% c 作用;% m % n   & lt;/PatternLayout>   & lt; Policies>   & lt; TimeBasedTriggeringPolicy 间隔=?”;   调节=皌rue",/比;   & lt;/Policies>   & lt; DefaultRolloverStrategy>   & lt; Delete  basePath=? {LOG_HOM}“, maxDepth=?“比;   & lt; IfFileName 水珠=癷nfoService * .gz",/比;   & lt; IfLastModified 年龄=? d",/比;   & lt;/Delete>   & lt;/DefaultRolloverStrategy>   & lt; ThresholdFilter 水平=癷nfo", onMatch=癆CCEPT"   onMismatch=癉ENY",/比;   & lt;/RollingRandomAccessFile>   & lt; RollingRandomAccessFile  name=癳rrorLog"   immediateFlush=皌rue",文件名=? {LOG_HOME}/errorService.log"   filePattern=? {LOG_HOME}/{yyyy-MM-dd} .log.gz" errorService.log. % d;比;   & lt; PatternLayout>   & lt; pattern> [% 5 p], [% d {yyyy-MM-dd  HH: mm: ss 瑞士}),% c 作用;% m % n   & lt;/PatternLayout>   & lt; Policies>   & lt; TimeBasedTriggeringPolicy 间隔=?”;   调节=皌rue",/比;   & lt;/Policies>   & lt; DefaultRolloverStrategy>   & lt; Delete  basePath=? {LOG_HOM}“, maxDepth=?“比;   & lt; IfFileName 水珠=癳rrorService * .gz",/比;   & lt; IfLastModified 年龄=? d",/比;   & lt;/Delete>   & lt;/DefaultRolloverStrategy>   & lt; ThresholdFilter 水平=癳rror", onMatch=癆CCEPT"   onMismatch=癉ENY",/比;   & lt;/RollingRandomAccessFile>   & lt; RollingRandomAccessFile  name=癴atalLog"   immediateFlush=皌rue",文件名=? {LOG_HOME}/fatalService.log"   filePattern=? {LOG_HOME}/{yyyy-MM-dd} .log.gz" fatalService.log. % d;比;   & lt; PatternLayout>   & lt; pattern> [% 5 p], [% d {yyyy-MM-dd  HH: mm: ss 瑞士}),% c 作用;% m % n   & lt;/PatternLayout>   & lt; Policies>   & lt; TimeBasedTriggeringPolicy 间隔=?”;   调节=皌rue",/比;   & lt;/Policies>   & lt; DefaultRolloverStrategy>   & lt; Delete  basePath=? {LOG_HOM}“, maxDepth=?“比;   & lt; IfFileName 水珠=癴atalService * .gz",/比;   & lt; IfLastModified 年龄=? d",/比;   & lt;/Delete>   & lt;/DefaultRolloverStrategy>   & lt; ThresholdFilter 水平=癴atal", onMatch=癆CCEPT"   onMismatch=癉ENY",/比;   & lt;/RollingRandomAccessFile>   & lt; RollingRandomAccessFile  name=癲ruidSqlLog"   immediateFlush=皌rue",文件名=? {LOG_HOME}/druidSql.log"   filePattern=? {LOG_HOME}/{yyyy-MM-dd} .log.gz" druidSql.log. % d;比;   & lt; PatternLayout>   & lt; pattern> [% 5 p], [% d {yyyy-MM-dd  HH: mm: ss 瑞士}),% c 作用;% m % n   & lt;/PatternLayout>   & lt; Policies>   & lt; TimeBasedTriggeringPolicy 间隔=?”;   调节=皌rue",/比;   & lt;/Policies>   & lt; DefaultRolloverStrategy>   & lt; Delete  basePath=? {LOG_HOM}“, maxDepth=?“比;   & lt; IfFileName 水珠=癲ruidSql * .gz",/比;   & lt; IfLastModified 年龄=? d",/比;   & lt;/Delete>   & lt;/DefaultRolloverStrategy>   & lt;/RollingRandomAccessFile>   & lt;/Appenders>   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

备忘录三:春天+德鲁伊+ log4j2引导