Grayscale monitoring of slf4j log stability monitoring

How to use error for stability monitoring and gray release monitoring?
1. Completeness.
2. Less intrusive.
3. Differentiability.

1. Filter by filter.
2. Realize by log configuration and encoder mechanism
3. Plus the key name (%c lowercase c, uppercase %C, not recommended, time-consuming, %method is not recommended, time-consuming) +
( http://logback.qos.ch/manual/layouts. html on the layout of logback)

1. Add encoder to replace the original patternEnCoder. 1.1 Add rootException class and reason. 1.2 Original loggerName 1.3 callerClass;

2. 

 

 

bad case


<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
   <layout class="ch.qos.logback.classic.PatternLayout">

     <pattern>%date [caller=%replace(%caller{1}){"\n",""}] [rootEx=%replace(%rEx{0}){"\n",""}]] [%level] [%c{0}.%method] [${lippi_meetingroom_current_environment}] m=%X{EAGLEEYE_RPC_METHOD} %msg t= %X{EAGLEEYE_TRACE_ID} %n          </pattern>
   </layout>
</appender>

protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Test public void testError(){ logger.error("123 {}", 3, new RuntimeException()); LoggerUtils.error(logger, this.getClass(), "test", "", new RuntimeException()); }

 

2020-05-02 19:36:47,982 [caller=Caller+0     at com.dingtalk.meetingroom.mocktest.manager.meeting.BookingManagerMockTest.testError(BookingManagerMockTest.java:60)]  [rootEx=java.lang.RuntimeException: null]]  [ERROR]  [BookingManagerMockTest.testError] [lippi_meetingroom_current_environment_IS_UNDEFINED] m=  123 3 t=  
java.lang.RuntimeException: null

2020-05-02 19:36:48,015 [caller=Caller+0     at com.dingtalk.common.log.LoggerUtils.error(LoggerUtils.java:48)] } [rootEx=java.lang.RuntimeException: null]]  [ERROR]  [BookingManagerMockTest.error] [lippi_meetingroom_current_environment_IS_UNDEFINED] m=  [DT_Monitor_V1] result=false, category=BookingManagerMockTest_test, reason=, traceId=, description=,  t=  
java.lang.RuntimeException: null

Guess you like

Origin blog.csdn.net/fei33423/article/details/105894403