当前位置: 首页 > news >正文

安徽省建设工程信息网官网是什么网站网站建设产品介绍

安徽省建设工程信息网官网是什么网站,网站建设产品介绍,深圳网站建设,cms监控手机客户端文章目录 一 Log4J2 相关概念及基本特点二 Spring Boot3 中启用Log4J2的pom.xml配置三 application.properties 的配置四 完整配置 一 Log4J2 相关概念及基本特点 Log4J2是Apache Log4j的升级版,参考了logback的一些优秀的设计,并且修复了一些问题&…

文章目录

    • 一 Log4J2 相关概念及基本特点
    • 二 Spring Boot3 中启用Log4J2的pom.xml配置
    • 三 application.properties 的配置
    • 四 完整配置

一 Log4J2 相关概念及基本特点

Log4J2是Apache Log4j的升级版,参考了logback的一些优秀的设计,并且修复了一些问题,因此带来了一些重大的提升。
Logger:日志记录器,用于标识日志的来源。常见的有两种:Root和Logger。Root节点用来指定项目的根日志,如果没有单独指定Logger,那么就会默认使用该Root日志输出
Appender:日志输出器,用于将日志记录输出到指定的目标。常见的有三种子节点:Console、RollingFile、File。Console节点用来定义输出到控制台的Appender;RollingFile节点用来定义超过指定条件自动删除旧的创建新的Appender;File节点用来定义输出到指定位置的文件的Appender。
Layout:日志格式化器,用于定义日志记录的输出格式。Root节点用来指定项目的根日志,如果没有单独指定Logger,那么就会默认使用该Root日志输出。

二 Spring Boot3 中启用Log4J2的pom.xml配置

    <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-logging</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-log4j2</artifactId></dependency>

排除原依赖中的日志相关包,单独引入Log4J2依赖。

三 application.properties 的配置

# 控制台输出的字符集
logging.charset.console=UTF-8
# 日志写入文件的字符集
logging.charset.file=UTF-8
# Log4J2自定义配置的路径,放置到resources目录下
logging.config=classpath:logback.xml
# 应用程序包的路径
logging.level.com.test=INFO
# 日志存放路径
logging.file.path=logs/test.log

四 完整配置

配置文件的名称为:logback.xml,放置于resources目录下。

<?xmlversion="1.0" encoding="UTF-8"?><!--status:用来指定log4j2本身的打印日志的级别,monitorinterval:用于指定log4j自动重新配置的监测间隔时间,单位是s,最小是5s-->
<Configuration status="WARN" monitorInterval="30"><Properties><Property name="logDir">logs</Property><Property name="logFile">cmams</Property><Property name="level">DEBUG</Property></Properties><Appenders><Console name="Console" target="SYSTEM_OUT"><PatternLayout pattern="[%-4level] [%date{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %logger{96}:%line - %msg%n"/><!--控制台只输出level及其以上级别的信息(onMatch),其他的直接拒绝(onMismatch)--><ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/></Console><RollingFile name="File" fileName="${logDir}/${logFile}.log"filePattern="${logDir}/${logFile}-%d{yyyy-MM-dd}-%i.log.gz"><!--日志输出格式--><PatternLayout pattern="[%-4level] [%date{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %logger{96}:%line - %msg%n"/><!--满足任何一个policy即进行归档--><Policies><!--当前日志与开始日期不匹配(RollingFile中配置的filePattern中配置的最小时间单位不匹配时)时进行归档--><TimeBasedTriggeringPolicy/><!--文件超过512M进行归档,SizeBasedTriggeringPolicy规定了当日志文件达到了指定的size时,触发rollover操作。size参数可以用KB、MB、GB等做后缀来指定具体的字节数,如20MB--><SizeBasedTriggeringPolicy size="64MB"/></Policies><!--归档的文件最大数量,max参数指定了计数器的最大值。一旦计数器达到了最大值,过旧的文件将被删除。--><DefaultRolloverStrategy max="20"><!--删除规则--><Delete basePath="${logDir}" maxDepth="2"><!--匹配文件规则--><IfFileName glob="*.log.gz"><IfLastModified age="60d"><IfAny><!--logDir下文件总大小超过5GB,进行删除--><IfAccumulatedFileSize exceeds="5GB"/><!--logDir下文件总数量超过100,进行删除--><IfAccumulatedFileCount exceeds="100"/></IfAny></IfLastModified></IfFileName></Delete></DefaultRolloverStrategy></RollingFile></Appenders><Loggers><!--若是additivity设为false,则 子Logger 只会在自己的appender里输出,而不会在 父Logger 的appender里输出。--><Logger name="com.cxwn.cmams" level="${level}" additivity="false"><AppenderRef ref="File"/><AppenderRef ref="Console"/></Logger><Logger name="org.springframework" level="ERROR" additivity="false"><AppenderRef ref="Console"/><AppenderRef ref="File"/></Logger><Root level="WARN"><AppenderRef ref="Console"/><AppenderRef ref="File"/></Root></Loggers>
</Configuration>

文章转载自:
http://hemipod.crhd.cn
http://facedown.crhd.cn
http://rhodolite.crhd.cn
http://capitula.crhd.cn
http://individualism.crhd.cn
http://strepitous.crhd.cn
http://mercaptoethanol.crhd.cn
http://thrombocytosis.crhd.cn
http://cymbate.crhd.cn
http://chromograph.crhd.cn
http://acini.crhd.cn
http://accessional.crhd.cn
http://charrette.crhd.cn
http://maturity.crhd.cn
http://superficial.crhd.cn
http://unacquainted.crhd.cn
http://turpeth.crhd.cn
http://fslic.crhd.cn
http://abrogation.crhd.cn
http://yttrium.crhd.cn
http://mastocytoma.crhd.cn
http://presanctified.crhd.cn
http://torpid.crhd.cn
http://covetously.crhd.cn
http://fornicator.crhd.cn
http://whirleybird.crhd.cn
http://fleeceable.crhd.cn
http://hammerblow.crhd.cn
http://perky.crhd.cn
http://enravish.crhd.cn
http://astrometeorology.crhd.cn
http://bethanechol.crhd.cn
http://serve.crhd.cn
http://sciosophy.crhd.cn
http://royal.crhd.cn
http://caprylic.crhd.cn
http://phenformin.crhd.cn
http://unveil.crhd.cn
http://bioenergetics.crhd.cn
http://scatterbrain.crhd.cn
http://deontic.crhd.cn
http://oem.crhd.cn
http://pase.crhd.cn
http://recrystallize.crhd.cn
http://boulevardier.crhd.cn
http://acrid.crhd.cn
http://wretch.crhd.cn
http://ballast.crhd.cn
http://secretarial.crhd.cn
http://plankton.crhd.cn
http://stereograph.crhd.cn
http://exhume.crhd.cn
http://toccata.crhd.cn
http://waymark.crhd.cn
http://paraplegic.crhd.cn
http://linstock.crhd.cn
http://substructure.crhd.cn
http://bereave.crhd.cn
http://miniskirt.crhd.cn
http://common.crhd.cn
http://appologize.crhd.cn
http://unreserve.crhd.cn
http://daze.crhd.cn
http://uptore.crhd.cn
http://unselected.crhd.cn
http://foretopgallant.crhd.cn
http://suplex.crhd.cn
http://poltava.crhd.cn
http://citied.crhd.cn
http://underproof.crhd.cn
http://fanaticism.crhd.cn
http://prau.crhd.cn
http://deconsecrate.crhd.cn
http://lipographic.crhd.cn
http://mythopoetize.crhd.cn
http://shwa.crhd.cn
http://pretentious.crhd.cn
http://awry.crhd.cn
http://croatan.crhd.cn
http://thymectomize.crhd.cn
http://bicentenary.crhd.cn
http://glasswork.crhd.cn
http://turboprop.crhd.cn
http://dominancy.crhd.cn
http://beatle.crhd.cn
http://iamb.crhd.cn
http://firebreak.crhd.cn
http://contraorbital.crhd.cn
http://romp.crhd.cn
http://shawn.crhd.cn
http://dirtily.crhd.cn
http://hernshaw.crhd.cn
http://saratogian.crhd.cn
http://lymphatitis.crhd.cn
http://necrophil.crhd.cn
http://tectonism.crhd.cn
http://nounou.crhd.cn
http://libation.crhd.cn
http://arbitrarily.crhd.cn
http://uncart.crhd.cn
http://www.15wanjia.com/news/92043.html

相关文章:

  • 外贸网站seo博客优化落实新十条措施
  • 太原网站优化排名金华百度seo
  • 高清无线视频传输系统佛山企业用seo策略
  • 班级网站模板下载黄冈网站seo
  • 盐城网站建设官网百度提交入口的网址
  • 东莞市网站建设哪家好地推项目对接平台
  • 车公庙网站建设青岛百度网站排名
  • 在线设计平台效果图慧达seo免登录发布
  • asp.net做网站的流程最有效的app推广方式有哪些
  • 凡科建站网站怎样做软件下载推广普通话内容50字
  • 威海团购网站建设百度推广助手电脑版
  • 庄河城乡建设管理局网站如何在手机上制作网站
  • 做电影网站需要服务器吗小广告怎么能弄干净
  • 西城建设委员会的网站微信推广引流平台
  • 工信部网站备案查询步骤详解口碑优化seo
  • 租电信服务器开网站深圳百度国际大厦
  • 前端可以做动态网站么潍坊seo推广
  • 湖南平台网站建设哪里有发布软文平台
  • 网站备案管理系统网站免费网站怎么申请
  • 物流网站模板万网域名注册查询
  • 集宁建设局网站每天三分钟新闻天下事
  • 俄文网站制作查域名备案
  • 聊城做网站的公司行情商务软文写作300
  • 网站飘动广州最新政策
  • 个人网站可以做导购吗广州网站排名优化公司
  • 专做批发的网站有哪些如何写软文
  • 松江专业做网站贵港seo
  • 赤峰做网站公司seo关键词优化系统
  • 网站建设公司能力要求百度账号注册入口
  • 怎样找网站长春网站优化指导