亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

log4j 日志文件排除日志消息

log4j 日志文件排除日志消息

慕娘9325324 2021-08-19 20:09:54
我正在2.0.2.RELEASE使用 BOM構建 Spring Boot 應用程序版本,Finchley.RC2并嘗試使用log4j2.xml. 問題是我只想記錄我的應用程序消息,例如:log.error("this is error");log.info("this is info");但是日志文件顯示了其他日志以及 Spring 日志等,如下所示:29-08-2018 18:01:45,023 [INFO ] [] [main] - this is info29-08-2018 18:01:45,492 [INFO ] [] [main] - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@b4711e2: startup date [Wed Aug 29 18:01:45 PKT 2018]; root of context hierarchy29-08-2018 18:01:45,659 [INFO ] [] [main] - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring29-08-2018 18:01:45,687 [INFO ] [] [main] - Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$af5d2aa2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)如何自定義我log4j2.xml的信息/調試/錯誤日志以僅實現我的應用程序日志記錄。下面是我的 log4j2.xml:<?xml version="1.0" encoding="UTF-8"?><Configuration>  <Appenders>    <RollingFile name="FileAppender" fileName="mylogFile.log"         append="true" filePattern="log-%d{MM-dd-yyyy}-%i.log">      <PatternLayout>        <pattern>%d{dd-MM-yyyy HH:mm:ss,SSS} [%-5p] [%X{X-B3-TraceId}] [%t] - %m%n</pattern>      </PatternLayout>      <Policies>        <TimeBasedTriggeringPolicy />        <SizeBasedTriggeringPolicy size="250 MB"/>      </Policies>      <DefaultRolloverStrategy max="20"/>    </RollingFile>    <Console name="STDOUT" target="SYSTEM_OUT">      <PatternLayout pattern="%d{dd-MM-yyyy HH:mm:ss,SSS} [%-5p] [%X{X-B3-TraceId}] [%t] - %m%n"/>    </Console>    <File name="JSONAppender" fileName="\\tmp\\logFile.json.log" append="true">    <JSONLayout complete="true" charset="UTF-8" compact="true" eventEol="true"/>任何幫助請問我的配置有什么問題?使用 Spring,1.5.9 version它工作正常,但當我升級到2.0.2.RELEASE日志文件時,它無法正常工作。
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 372 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號