Announcement Announcement Module
Collapse
No announcement yet.
Spring logging configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring logging configuration

    It's possible this has been asked already, but I haven't found anything relevant.

    I'm trying to set up logging within Spring, and have some problems with it - the log outputs too much (i.e., above the defined log level). Here's my log4j.properties file:

    # I assume this applies to ALL log output?
    log4j.rootLogger=warn, main
    log4j.appender.main=org.apache.log4j.ConsoleAppend er
    log4j.appender.main.layout=org.apache.log4j.Simple Layout

    Now, web.xml has the following entries:
    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>

    and

    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
    </listener>

    (my log4j.properties is in the classpath)

    Still, even though the log is set to WARN level, I keep getting the INFO messages in it! Like this:

    [15/08/05 12:34:48:412 EDT] 30fd247e WebContainer A SRVE0169I: Loading Web Module: SimpleApp.
    [15/08/05 12:34:48:683 EDT] 30fd247e ContextLoader I org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization started
    [15/08/05 12:34:48:683 EDT] 30fd247e WebGroup I SRVE0180I: [SimpleApp] [/SimpleApp] [Servlet.LOG]: Loading Spring root WebApplicationContext
    [15/08/05 12:34:48:853 EDT] 30fd247e XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefin itionReader Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
    [15/08/05 12:34:48:883 EDT] 30fd247e XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefin itionReader Loading XML bean definitions from ServletContext resource [/WEB-INF/databaseContext.xml]
    [15/08/05 12:34:49:083 EDT] 30fd247e XmlWebApplica I org.springframework.web.context.support.XmlWebAppl icationContext Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,userD ao,productDao,orderDao,config,applicationService]; root of BeanFactory hierarchy
    [15/08/05 12:34:49:113 EDT] 30fd247e XmlWebApplica I org.springframework.web.context.support.XmlWebAppl icationContext 8 beans defined in application context [Root WebApplicationContext]

    ... and the like.

    Why am I getting that? Am I doing something wrong?

    Thanks,

    Alex

  • #2
    there have been some support trails where the logger actually being picked up was not the correct one, such as 1.4 logger. One approach to verify this is to add some marker text to the log4j.properties file (log4j allows extra text in the pattern string).

    Comment

    Working...
    X