Re: Cayenne logging

From: Joe Baldwin (jfbaldwi..arthlink.net)
Date: Thu Jun 11 2009 - 12:01:23 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne logging"

    Andrus,

    Thanks for the apache logging link.

    Concerning:

    > In short, when your application starts, and before Cayenne is
    > loaded, you have to manually bootstrap log4j using
    > PropertyConfigurator class, specifying the config file:
    >
    > PropertyConfigurator.configure(myFile);
    >
    > This way you can't possibly misplace the config file (you'll get an
    > exception), and all your logging configuration will be accounted for.

    I remember reading this in your docs. However, since the scenario is
    a Tomcat webapp, I am not exactly sure where it is in the code that
    the app "starts". I think that this was a topic in your discussion
    (that I read, possibly for an older version), and it suggested that
    the cayenne-log.properties should be placed in a hidden directory
    ".cayenne" in the search path (which, I assume for a WebApp is either
    WEB-INF/lib or WEB-INF/config/cayenne-files - if you use the web.xml
    filter). <= could not get either of these to work btw.

    I am in total hack-mode and am looking for the "ON/OFF" switch. :)

    Joe

    On Jun 11, 2009, at 11:40 AM, Andrus Adamchik wrote:

    > I see, sorry for the confusion.
    >
    > As an aside Log4J *project* seems to be either dead or on life
    > support, abandoned by its authors, who moved to write the new
    > logging frameworks, which may or may not work with commons-logging.
    > Still the latest stable version of Log4J works great. Just figured
    > I'd mention..
    >
    > This Log4J doc may get you started:
    >
    > http://logging.apache.org/log4j/1.2/manual.html
    >
    > In short, when your application starts, and before Cayenne is
    > loaded, you have to manually bootstrap log4j using
    > PropertyConfigurator class, specifying the config file:
    >
    > PropertyConfigurator.configure(myFile);
    >
    > This way you can't possibly misplace the config file (you'll get an
    > exception), and all your logging configuration will be accounted for.
    >
    > Andrus
    >
    >
    > On Jun 11, 2009, at 5:59 PM, Joe Baldwin wrote:
    >> Andrus,
    >>
    >> I have not used log4j very much and definitely am not an expert at
    >> configuring it. I have not been able to implement the instructions
    >> found at
    >> http://cayenne.apache.org/doc/configuring-logging.html
    >> so that I can control logging.
    >>
    >> Quoting from 3.0M6 docs on your website:
    >> "Commons-logging allows users to choose their own logging
    >> provider, such as Log4J or java.util.logging."
    >> This is what I was attempting to convey in my last message (sorry,
    >> I was not trying to comment on 2.0 configuration)
    >>
    >> Furthermore, when I attempted to implement the example to turn SQL
    >> tracing off:
    >> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
    >> I found that there was no change in the output.
    >>
    >> So I can only assume that I am missing some fundamental part of the
    >> primer. My last theory is that I have either placed my cayenne-
    >> log.properties file in the wrong location, or I my configuration
    >> parameters are incomplete.
    >>
    >> Do you have any suggestions.
    >>
    >> Joe
    >>
    >>
    >>
    >>
    >> On Jun 11, 2009, at 10:37 AM, Andrus Adamchik wrote:
    >>
    >>>
    >>> On Jun 11, 2009, at 5:32 PM, Joe Baldwin wrote:
    >>>
    >>>> docs say that you can use either
    >>>
    >>> This can't be true... If you put org.objectstyle in the logging
    >>> config, it will have zero effect in 2.0 and 3.0.
    >>>
    >>> Andrus
    >>>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu Jun 11 2009 - 12:02:03 EDT