如何在log4j2中以编程方式更改Appender布局?(How to change Appender layout programatically in log4j2?)
以前在log4j 1.x中我能够appender.setLayout()和Appender,但现在在log4j 2.x中没有setLayout()这样的方法。 如何在log4j2中以编程方式将布局设置为Appender对象?
Previously in log4j 1.x I was able to to appender.setLayout() on and Appender but now in log4j 2.x there is no such method as setLayout(). How can I set a layout to an Appender object programatically in log4j2 ?
最满意答案
没有setLayout()方法。 您需要获取当前配置并在运行时更新它,如文档中所述。
There is no setLayout() method. You will need to get the current Configuration and update it during runtime as explained in the documentation.
更多推荐
发布评论