How to create custom RewritePolicy in log4j2?

后端 未结 2 475
既然无缘
既然无缘 2020-12-19 21:45

I\'m trying to code my own RewritePolicy in Log4j2. The documentation states that :

RewritePolicy is an interface that allows implementations to insp

2条回答
  •  佛祖请我去吃肉
    2020-12-19 21:56

    Don't forget the Factory Method for your plugin or it will fail to start:

        @PluginFactory
        public static MarkerInjectorRewritePolicy createPolicy() {
            return new MarkerInjectorRewritePolicy();
        }
    

    here's a working example on my github account: https://github.com/sercasti/Log4j-RewriteAppender/

提交回复
热议问题