我正在使用log4j2(版本-2.5),我正在尝试编写一个消息转换器插件,它将掩盖日志消息的一些已知模式.
@Plugin(name = “CustomeMasking”,category = “Converter”)
@ConverterKeys({“m”})
public class MyCustomFilteringLayout extends LogEventPatternConverter {
}
当我使用此插件运行我的Web应用程序时,我看到此警告消息
WARN Converter key ‘m’ is already mapped to ‘class
org.apache.logging.log4j.core.pattern.MessagePatternConverter’. Sorry,
Dave,I can’t let you do that! Ignoring plugin [class
MyCustomFilteringLayout].
在探索log4j2网站后,我找到了这些参考资料.
If multiple Converters specify the same ConverterKeys,then the load
order above determines which one will be used. For example,to
override the %date converter which is provided by the built-in
DatePatternConverter class,you would need to place your plugin in a
JAR file in the CLASSPATH ahead of log4j-core.jar. This is n