How to set log4j.properties in Eclipse?

前端 未结 3 1313
鱼传尺愫
鱼传尺愫 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:35

    Your log4j.properties should reside inside the src folder. That way, Log4J will configure itself automatically, without you needing to write code.

    0 讨论(0)
  • 2021-02-09 16:36

    According to your project structure, there is no log4j-jms.properties.There is log4j.properties. So change your log4j properties file name.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题