第一步: Get the filter chain
触发过滤器,如果过滤器返回FilterReply.DENY,抛弃logging request;返回FilterReply.NEUTRAL,继续执行下一个过滤器;返回FilterReply.ACCEPT,忽略之后的过滤器,进入下一步。
第二步: Apply the basic selection rule
比较logging request的level与Logger对象的level。 Request level < logger level,则logging request被丢弃。
第三步: Create a LoggingEvent Object
创建LoggingEvent对象,这个步骤类似于前端触发事件流程,它的作用与前端Event对象的作用是相同的,封装请求的信息。
第四步: Invoking Appender
触发Logger中Appender对象的doAppender方法,方法的参数为LoggingEvent。
第五步: Formatting the output
Appender对象依赖Layout对象,此时触发Appender中的Layout对象的doLayout方法,参数为LoggingEvent。它会将LoggingEvent对象转换为字符串。
第六步: Sending out the LoggingEvent
将返回的字符串写入到各个终端。