Announcement Announcement Module
Collapse
No announcement yet.
Log4J warning when runing test: How to fix Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Log4J warning when runing test: How to fix

    I get log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlA pplicationContext). When I run my test.

    In my test case I am initialising the ClassPathXmlApplicationContext as below but in the logs i get the message "log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlA pplicationContext)."

    Code:
        private static ClassPathXmlApplicationContext classPathXmlApplicationContext;
        
       
        @BeforeClass
        public static void loadContext() {
           classPathXmlApplicationContext = new ClassPathXmlApplicationContext("contextFile");
        }
    Log4J is on the class path what else do i need to do. Im using Junit 3 in other projects and its not loaded as a static method in other projects could that be the probelm.

  • #2
    You'd need to drop a log4j.properties file in your classpath with a minimal log4j configuration. Unless you actually WANT to look at logging output from your tests, frankly, I'd just ignore it. That's the standard output from log4j when it isn't configured at runtime; you can safely ignore it.

    Comment


    • #3
      I added a log4j.properties file with the following details and it now works.

      log4j.rootLogger=INFO, stdout
      log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
      log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
      log4j.appender.stdout.layout.ConversionPattern=%d %p [%t] %c - %m - %r %n

      Comment


      • #4
        ..

        I also get log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlA pplicationContext). log4j:WARN Please initialize the log4j system properly.
        When I run application. I already had a log4j.property but still didnt work

        Comment

        Working...
        X