logback configuration color highlighting

logback configuration color highlighting

In the logback log framework, you can set the color character format to output the log content to the terminal, so that people can intuitively view the contents of different log parts, which is convenient for quickly viewing and locating problems

Official document description: http://logback.qos.ch/manual/layouts.html#coloring

Supported color character encodings

%black 黑色

%red 红色

%green 绿色

%yellow 黄色

%blue 蓝色

%magenta 洋红色

%cyan 青色

%white 白色

%gray 灰色

以下为对应加粗的颜色代码
%boldRed

%boldGreen

%boldYellow

%boldBlue

%boldMagenta

%boldCyan

%boldWhite

%highlight 高亮色

<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<encoder>
<pattern>
%highlight(%date{yyyy-MM-dd HH:mm:ss.SSS}) %cyan([%thread]) %yellow(%-5level) %green(%logger{36}).%gray(%M)-%boldMagenta(%line) - %blue(%msg%n)
</pattern>
</encoder>
</appender>

Guess you like

Origin blog.csdn.net/weixin_45839894/article/details/126622478