Browse Source
Merge in DESIGN/design from ~HADES/design:feature/x to feature/x * commit '33e1ac2dde3ffbf1e9de84286b76cde412e8b3a5': REPORT-64300 远程设计时日志推送问题feature/x
Hades
3 years ago
2 changed files with 1 additions and 28 deletions
@ -1,27 +0,0 @@ |
|||||||
package com.fr.design.mainframe.loghandler; |
|
||||||
|
|
||||||
import com.fr.third.apache.log4j.spi.LoggingEvent; |
|
||||||
import com.fr.third.apache.logging.log4j.Level; |
|
||||||
import com.fr.third.apache.logging.log4j.core.LogEvent; |
|
||||||
import com.fr.third.apache.logging.log4j.core.impl.Log4jLogEvent; |
|
||||||
import com.fr.third.apache.logging.log4j.message.SimpleMessage; |
|
||||||
|
|
||||||
/** |
|
||||||
* 兼容log4j1和2之间logEvent之间的转换 |
|
||||||
* |
|
||||||
* @author hades |
|
||||||
* @version 11.0 |
|
||||||
* Created by hades on 2021/12/9 |
|
||||||
*/ |
|
||||||
public class LogEventConverter { |
|
||||||
|
|
||||||
public static LogEvent convert(LoggingEvent loggingEvent) { |
|
||||||
SimpleMessage message = new SimpleMessage(loggingEvent.getRenderedMessage()); |
|
||||||
return Log4jLogEvent.newBuilder(). |
|
||||||
setMessage(message). |
|
||||||
setLevel(Level.getLevel(loggingEvent.getLevel().toString())). |
|
||||||
build(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue