Sample xml configuration for log4j, have a 'main' java application and want to write to file

前端 未结 3 1870
感情败类
感情败类 2020-12-11 00:40

Are there any example log4j configuration files (XML).

I have a java main application.

I want log4j to output to console AND write to file.

Any examp

3条回答
  •  死守一世寂寞
    2020-12-11 01:15

    The typical thing to do is to put a log4j.properties file in your classpath. The log4j doc will tell you all you need to know about having two appenders for the console and a file, it's in their examples. In other words, don't bother with the less common XML format and stick with the very common properties format.

提交回复
热议问题