Re: Extensive DEBUG Logging when using a WebApplicationListener

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 23 2004 - 13:06:44 EDT

  • Next message: Twan Kogels: "Re: Extensive DEBUG Logging when using a WebApplicationListener"

    I think the cause of the problem is that cayenne.jar has a default
    logging properties file (under
    cayenne.jar:.cayenne/cayenne-log.properties), which has this:

    log4j.rootLogger=DEBUG, A1
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=%-5p %c{1}: %m%n
    log4j.logger.org.objectstyle.cayenne = WARN
    ...

    I guess the logging system in Cayenne is up for rework in the future
    versions. For RC1 I will change the default to be INFO, not DEBUG.
    Regardless of this in the web application I suggest subclassing
    WebApplicationListener with a simple custom subclass that overrides
    this method:

    public void contextInitialized(ServletContextEvent sce) {
        // configure log4j logging, before Cayenne does, e.g.:
        URL myLog4JpropsURL = ...
         
    org.objectstyle.cayenne.conf.Configuration.configureCommonLogging(myLog4
    JpropsURL);

        super.contextInitialized(sce);
    }

    On Sep 23, 2004, at 12:24 PM, Eric Schneider wrote:
    > Cris,
    >
    >> log4j.logger.org.apache = INFO
    >
    > I just tried this, but it still seems to blow out the logging.... :-\
    >
    > Is there anything else I could be missing?
    >
    > here's my current log4j.properties file:
    >
    > # turn off logging
    > log4j.rootLogger=WARN, A1
    > log4j.appender.A1=org.apache.log4j.ConsoleAppender
    > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    > log4j.appender.A1.layout.ConversionPattern=processing %-5p [%t
    > %d{yyyy-dd-MM HH:mm:ss}] %c{1}: %m%n
    >
    > # turn on indiv. packages
    > log4j.logger.org.objectstyle.cayenne = DEBUG
    > log4j.logger.org.apache = INFO
    >
    >
    > thanks,
    > e.
    >
    >
    > On Sep 23, 2004, at 11:57 AM, Cris Daniluk wrote:
    >
    >> Tomcat uses commons-digester to do its XML parsing. Digester is very
    >> noisy
    >> in debug mode, which is the logging level Cayenne defaults to.
    >>
    >> You can override this with your own logging settings. If you're using
    >> log4j
    >> in your project, add this to your log4j.properties file:
    >>
    >> log4j.logger.org.apache = INFO
    >>
    >> If you're not, Cayenne is using it anyway, so you can make a
    >> log4j.properties file in your classes folder (see the Log4j docs for
    >> how
    >> this should look) and add a commons-logging.properties file to your
    >> classes
    >> folder that has the following:
    >>
    >> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLo
    >> gger
    >> log4j.configuration=log4j.properties
    >>
    >> Of course, you can also turn down log4j logging at runtime but config
    >> files
    >> are your best bet because this noise is probably happening before
    >> your code
    >> would ever be executed.
    >>
    >> Cris
    >>> -----Original Message-----
    >>> From: Stefaan Huysentruyt [mailto:cayenne.user..inimoa.net]
    >>> Sent: Thursday, September 23, 2004 11:36 AM
    >>> To: cayenne-use..bjectstyle.org
    >>> Subject: Extensive DEBUG Logging when using a WebApplicationListener
    >>>
    >>> Hi everybody,
    >>>
    >>> Tried with 1.1B2 and 1.1B3:
    >>>
    >>> If I setup the tutorial Webapp with Tomcat and Struts, I get
    >>> an extensive struts? configuration debugging log at each
    >>> context (re)load.
    >>>
    >>> I only experience it with contexts dat use the cayenne.jar.
    >>>
    >>> When I remove the listener from web.xml the DEBUG log
    >>> dissapears, but of course I get ================ log4j:WARN
    >>> No appenders could be found for logger
    >>> (org.apache.struts.util.PropertyMessageResources).
    >>> log4j:WARN Please initialize the log4j system properly.
    >>> =================
    >>>
    >>> This is a glimps of the head of the debug log.
    >>> ===========================
    >>> DEBUG Digester: register('-//Apache Software Foundation//DTD
    >>> Struts Configuration 1.0//EN', 'jar:file:/C:/Documents and
    >>> Settings/Stefaan/Mijn
    >>> documenten/WorkSpace/Cayenne/WEB-INF/lib/struts.jar!/org/apach
    >> e/struts/resources/struts-config_1_0.dtd'
    >>> DEBUG Digester: register('-//Apache Software Foundation//DTD
    >>> Struts Configuration 1.1//EN', 'jar:file:/C:/Documents and
    >>> Settings/Stefaan/Mijn
    >>> documenten/WorkSpace/Cayenne/WEB-INF/lib/struts.jar!/org/apach
    >> e/struts/resources/struts-config_1_1.dtd'
    >>> DEBUG Digester: register('-//Sun Microsystems, Inc.//DTD Web
    >>> Application 2.2//EN', 'jar:file:/C:/Documents and
    >>> Settings/Stefaan/Mijn
    >>> documenten/WorkSpace/Cayenne/WEB-INF/lib/struts.jar!/org/apach
    >>> e/struts/resources/web-app_2_2.dtd'
    >>> DEBUG Digester: register('-//Sun Microsystems, Inc.//DTD Web
    >>> Application 2.3//EN', 'jar:file:/C:/Documents and
    >>> Settings/Stefaan/Mijn
    >>> documenten/WorkSpace/Cayenne/WEB-INF/lib/struts.jar!/org/apach
    >>> e/struts/resources/web-app_2_3.dtd'
    >>> DEBUG ActionServlet: Scanning web.xml for controller servlet
    >>> mapping DEBUG sax:
    >>> setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser
    >>> $LocatorProx..a39d7)
    >>> DEBUG sax: startDocument()
    >>> DEBUG sax: resolveEntity('-//Sun Microsystems, Inc.//DTD Web
    >>> Application 2.3//EN', 'http://java.sun.com/dtd/web-app_2_3.dtd')
    >>> DEBUG Digester: Resolving to alternate DTD
    >>> 'jar:file:/C:/Documents and Settings/Stefaan/Mijn
    >>> documenten/WorkSpace/Cayenne/WEB-INF/lib/struts.jar!/org/apach
    >>> e/struts/resources/web-app_2_3.dtd'
    >>> DEBUG sax: startElement(,web-app,web-app)
    >>> DEBUG Digester: Pushing body text ''
    >>> DEBUG Digester: New match='web-app'
    >>> DEBUG Digester: No rules found matching 'web-app'.
    >>> DEBUG sax: ignorableWhitespace(
    >>> )
    >>> DEBUG sax: ignorableWhitespace( )
    >>> DEBUG sax: ignorableWhitespace(
    >>> )
    >>> DEBUG sax: startElement(,listener,listener)
    >>> DEBUG Digester: Pushing body text ''
    >>> DEBUG Digester: New match='web-app/listener'
    >>> DEBUG Digester: No rules found matching 'web-app/listener'.
    >>> ...
    >>> =============================
    >>>
    >>> Any clue?
    >>>
    >>> Thanks,
    >>>
    >>> Stefaan Huysentruyt
    >>>
    >>>
    >>>
    >>



    This archive was generated by hypermail 2.0.0 : Thu Sep 23 2004 - 13:06:51 EDT