how to change the log4j log file dynamically?

前端 未结 2 1763
-上瘾入骨i
-上瘾入骨i 2021-01-13 13:51

I want to have a log4j configuration such that the log file name should have like ${System-name}log.log. that is if the application is launched on any system then without ch

2条回答
  •  旧巷少年郎
    2021-01-13 14:36

    I do it this way:
    1) init logger by:

    System.setProperty("my.logsDir", vcsLogsDir);
    DOMConfigurator.configure("c:/log4j.xml");
    

    2) in log4j.xml i use variable:

    d
    

提交回复
热议问题