log4j,logback,sl4j常用日志格式详解

本文详细介绍了 Log4j2 中的日志输出格式配置选项,包括日期、日志级别、日志内容等关键元素的展示方式,并提供了性能影响方面的注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


%d{HH:mm:ss.SSS}:    打印日期 ------------ utputs the date of the logging event. )
%p: 打印日志级别  ------------   Outputs the level of the logging event.
%c{40}:打印日志内容 ----------- Outputs the name of the logger that published the logging event.
%C: 打印调用日志所在类名字 ----------- Outputs the fully qualified class name of the caller issuing the logging request. may impact performance
%t:打印线程----------- Outputs the name of the thread that generated the logging event.)
%m:打印log 信息 ------------- Outputs the application supplied message associated with the logging event.)
%M: 打印方法名称 ------------ Outputs the method name where the logging request was issued.
%n:换行----------Outputs the platform dependent line separator character or characters.)
%L:打印日志所在行  -------- Outputs the line number from where the logging request was issued.may impact performance)

%highlight:  指定日志信息高亮  --------  Adds ANSI colors to the result of the enclosed pattern based on the current event's logging level.


参考链接:

http://logging.apache.org/log4j/2.x/manual/layouts.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值