Re: help with figuring out logging?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Apr 03 2003 - 20:49:27 EST

  • Next message: Denis Haskin: "Re: help with figuring out logging?"

    Hi Denis,

    On Thursday, April 3, 2003, at 07:06 PM, Denis Haskin wrote:

    > Aha!  I just found cayenne-log.properties in cayenne.jar, and also the
    > API doc entry for
    > org.objectstyle.cayenne.conf.Configuration.configCommonLogging() that
    > says "Search for the properties file called cayenne-log.properties is
    > first done in $HOME/.cayenne, then in CLASSPATH."
    >
    > Hmm.  How can I override this?  (Short of repacking the jar to get rid
    > of that file?)

    Let me explain.

    Cayenne uses log4j exclusively. JDK 1.4 logging settings that you are
    referring to are therefore ignored (so removing cayenne-log.properties
    will not change much for you). Note that we don't use commons-logging
    wrapper either, since at some point we felt that such "least common
    denominator" approach limits what you can do with logging. And yes, I
    totally feel like there is too many logging APIs in Java ;-).

    The solution to customize cayenne-specific logging would be to create
    an extra properties file using the log4j format, e.g.:

        
    http://www.objectstyle.org/cayenne/lists/cayenne-user/2003/01/0014.html
        
    http://www.objectstyle.org/cayenne/lists/cayenne-devel/2002/11/0082.html

    (log4j.logger.org.objectstyle.cayenne.access.QueryLogger is the
    important one - it controls the output of the SQL operations)

    If you don't want to call it cayenne-log.properties and/or put it in
    CLASSPATH, you can override this by calling
    Configuration.configCommonLogging(java.net.URL) before anything
    "Cayenne" is instantiated. You can supply your own logging file as an
    argument, but like I said, this has to be log4j properties (unless
    Log4J is smart enough now to recognize the JDK 1.4 format?).

    Also note that this will not interfere with you JDK1.4-specific logging
    in any way.

    Hope this helps.

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Apr 03 2003 - 20:54:07 EST