Results 1 to 2 of 2

Thread: Spring logging configuration

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

    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).

Similar Threads

  1. Gaijin Studio for Spring MVC 0.9.2 Released
    By dadams in forum Announcements
    Replies: 8
    Last Post: May 30th, 2007, 10:48 PM
  2. Spring Logging Configuration
    By isusanin in forum Data
    Replies: 3
    Last Post: Jul 26th, 2005, 05:34 PM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •