How to set log4j.properties in Eclipse?

前端 未结 3 1315
鱼传尺愫
鱼传尺愫 2021-02-09 16:27

I\'m trying to run this example, but I have some problems with configuration.

I copied log4j-jms.properties, jndi.properties, Log4jJMSApp

3条回答
  •  死守一世寂寞
    2021-02-09 16:51

    1. There is nothing about imports;

    2. It's not about the file place, as you see this message "log4j:WARN No appenders could be found for logger...", so please check the content of your log4j configuration file. Here's a demo:

      log4j.rootLogger=INFO, myConsoleAppender log4j.appender.myConsoleAppender=org.apache.log4j.ConsoleAppender log4j.appender.myConsoleAppender.layout=org.apache.log4j.PatternLayout log4j.appender.myConsoleAppender.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

    3. The default log4j configuration file is "log4j.properties", and as someone had said it should be place in the src folder.

提交回复
热议问题