How to create multiple log file programatically in log4j2?

后端 未结 2 856
执笔经年
执笔经年 2021-01-23 05:05

I am developing a java application which communicates with lots of devices. For each device I need to create a different log file to log it\'s communication with device. This is

2条回答
  •  佛祖请我去吃肉
    2021-01-23 05:10

    The approach log4j2 is initialize programmatically and later configuration is modified is different. And you you trying to add dynamic appender and logger using initialization approach.

    So, first you should initialize your RootLogger using initialization approach that seems correct in your code.

    After that, add dynamic appender and logger using approach mentioned here

提交回复
热议问题