Announcement Announcement Module
No announcement yet.
Spring ALWAYS logs INFO messages? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring ALWAYS logs INFO messages?

    Using Spring 2.5.4 MVC

    My EAR application contains a single WAR component(obviously the MVC bit) and an EJB, structure as follows -

    WAR -


    WEB-INF\lib\log4j-1.2.14.jar contains -

    # Global logging configuration
    log4j.rootLogger=DEBUG, stdout

    # Console output
    log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
    log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
    log4j.appender.stdout.layout.ConversionPattern=%-5p %d{dd-MMM-yyyy HH:mm:ss} %c{1} - %m%n oproxy=DEBUG, stdout

    The problem is Spring ALWAYS logs INFO messages and seems to totally ignore settings.

    Inspecting the "logger" object provided by Spring in my SimpleFormController shows it to be of type org.apache.commons.logging.impl.Jdk14Logger which according to a previous thread indicates Spring can't find commons-logging but it's def in the class path!

    Must be missing something, in the web.xml perhaps?

    This has really stumped me! any ideas? anything at all?



  • #2
    Spring isn't ignoring anything. Your loglevel is DEBUG so everything higer than DEBUG is also logged. DEBUG means log everyting including the kitchen sink... If you don't want info messages you need to set your log level to WARN.

    Also make sure that spring isn't loaded BEFORE log4j else it cannot detect log4j. So i what I expect that is happening is that spring is loaded by your ear classloader whereas log4j is loaded by your web app classloader.
    Last edited by Marten Deinum; May 23rd, 2008, 03:28 AM.


    • #3
      thanks for such a quick reply Marten!

      Should have made it a bit clearer, even when level is set to FATAL Spring still logs INFO messages.

      What is interesting though is your other idea, in the APP-INF/classes folder I have log4j properties & jar file as I need looging from my EJB, this seems to be exactly what you say with the ear classloader.

      Any ideas (hopefully very quick and simple) how I can do what you say?



      • #4
        ah ha! - for anyone who comes across it -

        In EAR's MANIFEST.MF file -

        Manifest-Version: 1.0
        Class-Path: log4j-1.2.14.jar spring.jar