You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Jason Ward <jw...@gmail.com> on 2009/06/11 16:13:38 UTC

Cayenne logging

I realize this (basic) question has been asked a lot, but I'm still 
struggling to get logging disabled with Cayenne 3.0M6.

I'm using log4j in my web-app and I'm starting tomcat with the 
log4j.configDebug=true flag so I can see that my properties file is 
loaded before my servlet inits. Despite my best efforts these lines 
aren't being honored :

log4j.logger.org.objectstyle.cayenne = OFF
log4j.logger.org.objectstyle.cayenne.access.QueryLogger = OFF
log4j.logger.org.objectstyle.cayenne.conf = OFF
log4j.logger.org.objectstyle.cayenne.util = OFF

...even tho you can see log4j seems to be setting the values appropriately:
log4j: Parsing for [org.objectstyle.cayenne.access.QueryLogger] with 
value=[OFF].
log4j: Level token is [OFF].
log4j: Category org.objectstyle.cayenne.access.QueryLogger set to OFF
log4j: Handling 
log4j.additivity.org.objectstyle.cayenne.access.QueryLogger=[null]

It seems Cayenne's events head for the rootLogger and only mods to that 
have an impact. This really isn't a suitable situation for me because I 
need the rootLogger at an INFO level for other components.

Can someone out there steer me in the right direction?

Thanks,
Jason

Re: Cayenne logging

Posted by Jason Ward <jw...@gmail.com>.
Yup. Great catch. Sorry about that. I was still looking at the 2.x user 
guide.

Aristedes Maniatis wrote:
> On 12/6/09 12:13 AM, Jason Ward wrote:
>>
>> log4j.logger.org.objectstyle.cayenne = OFF
>> log4j.logger.org.objectstyle.cayenne.access.QueryLogger = OFF
>> log4j.logger.org.objectstyle.cayenne.conf = OFF
>> log4j.logger.org.objectstyle.cayenne.util = OFF
>
> Note that the packaging changed from org.objectstyle to org.apache 
> with Cayenne 2.x. That is probably your problem.
>
> Ari Maniatis

Re: Cayenne logging

Posted by Michael Gentry <mg...@masslight.net>.
Hi Joe, I think you want an Application Listener.  This is a class
that implements javax.servlet.ServletContextListener which a servlet
engine (such as Tomcat) is supposed to notify on application startup.
For example:

public class ApplicationListener implements ServletContextListener
{
...
public void contextInitialized(ServletContextEvent sce) {}
public void contextDestroyed(ServletContextEvent sce) {}
...
}

You'd put your log4j/etc initialization in contextInitialized().
You'll also need to add to your web.xml file:

<listener>
  <listener-class>com.foo.bar.ApplicationListener</listener-class>
</listener>

This informs the servlet engine (Tomcat) which listener class to use.
There is also a listener for session events should you need it
(implement javax.servlet.http.HttpSessionListener somewhere and add
another <listener> section in web.xml).  The listeners should work in
all servlet engines (Tomcat, Jetty, etc).

mrg


On Thu, Jun 11, 2009 at 12:01 PM, Joe Baldwin<jf...@earthlink.net> wrote:
> 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.
>

Re: Cayenne logging

Posted by Andrey Razumovsky <ra...@gmail.com>.
You certainly need not recompile anything and there's no need for
logging.properties file, only log4j configuration. Just setup log4j as
specified: http://tomcat.apache.org/tomcat-6.0-doc/logging.html

2009/6/13 Joe Baldwin <jf...@earthlink.net>

> Andrey,
>
> Yes, it sounds like your suggestion is the next best option to try..  (When
> Andrus said that he thought that log4j was an abandoned project, I became
> hesitant about relying on it as a stable component for the future.)
>
> I recall reading that the docs for Tomcat 6 say that it is not included by
> default and that you have to compile the source and configure a few things.
>
> I am trying to remember why it was that I was putting off goofing around
> with logging until the very end of my project. :)
>
> Which one do you suggest, and can I borrow your properties file? :)
>
> Thanks,
> Joe
>
>
>
>
> On Jun 13, 2009, at 2:10 AM, Andrey Razumovsky wrote:
>
>  Hi Joe!
>>
>> As far as I know, Juli is a weak logging system. For instance, I haven't
>> found any rolling file appenders, so my logs grew endlessly. I will not be
>> surprised if it doesn't support optional package loading. I reccomend you
>> to
>> switch to Log4j or something.
>>
>> Andrey
>>
>> 2009/6/12 Joe Baldwin <jf...@earthlink.net>
>>
>>  Andrus,
>>>
>>> I did quite a few tests yesterday and still cannot determine whether the
>>> Tomcat logging.properties method will ever work.
>>>
>>> The directives that seem to work are as follows:
>>>
>>>      handlers = org.apache.juli.FileHandler
>>>      org.apache.juli.FileHandler.directory = ${catalina.base}/logs
>>>      org.apache.juli.FileHandler.prefix = mywebapp.
>>>      org.apache.juli.FileHandler.level = WARN
>>>
>>> The last line will turns off all logging.  If this is changed to "INFO"
>>> then logging is turned on.  However, I cannot get the cayenne
>>> "QueryLogger",
>>> "conf", or "util" directives to work.  It may be my syntax (using juli),
>>> or
>>> it may be that Tomcat juli will not disseminate the directives, or it may
>>> be
>>> that it just cannot be done with juli logging.properties.
>>>
>>> Thanks,
>>> Joe
>>>
>>>
>>>
>>> On Jun 12, 2009, at 2:12 AM, Andrus Adamchik wrote:
>>>
>>>
>>>  On Jun 11, 2009, at 11:05 PM, Joe Baldwin wrote:
>>>>
>>>> Question:
>>>>
>>>>> Is is possible that the Cayenne hard-coded defaults (which I read about
>>>>> somewhere in your docs), are over-riding my loggin.properties?
>>>>>
>>>>>
>>>> Actually no. Cayenne (or your application code) would log something with
>>>> a
>>>> certain priority. A logging framework decides whether a given priority
>>>> should be logged or ignored. I have very little experience with the new
>>>> Tomcat "juli" logger. So another random thing to try: instead of OFF,
>>>> can
>>>> you try WARN (Cayenne logs everything with level INFO, so WARN should
>>>> suppress the logging).
>>>>
>>>> Andrus
>>>>
>>>>
>>>
>>>
>

Re: Cayenne logging

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 14/6/09 12:58 AM, Joe Baldwin wrote:
> When Andrus said that he thought that log4j was an abandoned project, I
> became hesitant about relying on it as a stable component for the future.)

I would certainly recommend log4j. It is easy to use and completely robust. It may not have been updated for many years, but that also indicates the stability of the tool. It just works.

I've written an appender for log4j to submit errors to HTTP. Then we have a system that feeds the error into our bug tracking system. It is all quite simple.

Ari Maniatis

Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
Andrey,

Yes, it sounds like your suggestion is the next best option to try..   
(When Andrus said that he thought that log4j was an abandoned project,  
I became hesitant about relying on it as a stable component for the  
future.)

I recall reading that the docs for Tomcat 6 say that it is not  
included by default and that you have to compile the source and  
configure a few things.

I am trying to remember why it was that I was putting off goofing  
around with logging until the very end of my project. :)

Which one do you suggest, and can I borrow your properties file? :)

Thanks,
Joe



On Jun 13, 2009, at 2:10 AM, Andrey Razumovsky wrote:

> Hi Joe!
>
> As far as I know, Juli is a weak logging system. For instance, I  
> haven't
> found any rolling file appenders, so my logs grew endlessly. I will  
> not be
> surprised if it doesn't support optional package loading. I  
> reccomend you to
> switch to Log4j or something.
>
> Andrey
>
> 2009/6/12 Joe Baldwin <jf...@earthlink.net>
>
>> Andrus,
>>
>> I did quite a few tests yesterday and still cannot determine  
>> whether the
>> Tomcat logging.properties method will ever work.
>>
>> The directives that seem to work are as follows:
>>
>>       handlers = org.apache.juli.FileHandler
>>       org.apache.juli.FileHandler.directory = ${catalina.base}/logs
>>       org.apache.juli.FileHandler.prefix = mywebapp.
>>       org.apache.juli.FileHandler.level = WARN
>>
>> The last line will turns off all logging.  If this is changed to  
>> "INFO"
>> then logging is turned on.  However, I cannot get the cayenne  
>> "QueryLogger",
>> "conf", or "util" directives to work.  It may be my syntax (using  
>> juli), or
>> it may be that Tomcat juli will not disseminate the directives, or  
>> it may be
>> that it just cannot be done with juli logging.properties.
>>
>> Thanks,
>> Joe
>>
>>
>>
>> On Jun 12, 2009, at 2:12 AM, Andrus Adamchik wrote:
>>
>>
>>> On Jun 11, 2009, at 11:05 PM, Joe Baldwin wrote:
>>>
>>> Question:
>>>> Is is possible that the Cayenne hard-coded defaults (which I read  
>>>> about
>>>> somewhere in your docs), are over-riding my loggin.properties?
>>>>
>>>
>>> Actually no. Cayenne (or your application code) would log  
>>> something with a
>>> certain priority. A logging framework decides whether a given  
>>> priority
>>> should be logged or ignored. I have very little experience with  
>>> the new
>>> Tomcat "juli" logger. So another random thing to try: instead of  
>>> OFF, can
>>> you try WARN (Cayenne logs everything with level INFO, so WARN  
>>> should
>>> suppress the logging).
>>>
>>> Andrus
>>>
>>
>>


Re: Cayenne logging

Posted by Andrey Razumovsky <ra...@gmail.com>.
Hi Joe!

As far as I know, Juli is a weak logging system. For instance, I haven't
found any rolling file appenders, so my logs grew endlessly. I will not be
surprised if it doesn't support optional package loading. I reccomend you to
switch to Log4j or something.

Andrey

2009/6/12 Joe Baldwin <jf...@earthlink.net>

> Andrus,
>
> I did quite a few tests yesterday and still cannot determine whether the
> Tomcat logging.properties method will ever work.
>
> The directives that seem to work are as follows:
>
>        handlers = org.apache.juli.FileHandler
>        org.apache.juli.FileHandler.directory = ${catalina.base}/logs
>        org.apache.juli.FileHandler.prefix = mywebapp.
>        org.apache.juli.FileHandler.level = WARN
>
> The last line will turns off all logging.  If this is changed to "INFO"
> then logging is turned on.  However, I cannot get the cayenne "QueryLogger",
> "conf", or "util" directives to work.  It may be my syntax (using juli), or
> it may be that Tomcat juli will not disseminate the directives, or it may be
> that it just cannot be done with juli logging.properties.
>
> Thanks,
> Joe
>
>
>
> On Jun 12, 2009, at 2:12 AM, Andrus Adamchik wrote:
>
>
>> On Jun 11, 2009, at 11:05 PM, Joe Baldwin wrote:
>>
>>  Question:
>>> Is is possible that the Cayenne hard-coded defaults (which I read about
>>> somewhere in your docs), are over-riding my loggin.properties?
>>>
>>
>> Actually no. Cayenne (or your application code) would log something with a
>> certain priority. A logging framework decides whether a given priority
>> should be logged or ignored. I have very little experience with the new
>> Tomcat "juli" logger. So another random thing to try: instead of OFF, can
>> you try WARN (Cayenne logs everything with level INFO, so WARN should
>> suppress the logging).
>>
>> Andrus
>>
>
>

Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
Andrus,

I did quite a few tests yesterday and still cannot determine whether  
the Tomcat logging.properties method will ever work.

The directives that seem to work are as follows:

	handlers = org.apache.juli.FileHandler
	org.apache.juli.FileHandler.directory = ${catalina.base}/logs
	org.apache.juli.FileHandler.prefix = mywebapp.
	org.apache.juli.FileHandler.level = WARN

The last line will turns off all logging.  If this is changed to  
"INFO" then logging is turned on.  However, I cannot get the cayenne  
"QueryLogger", "conf", or "util" directives to work.  It may be my  
syntax (using juli), or it may be that Tomcat juli will not  
disseminate the directives, or it may be that it just cannot be done  
with juli logging.properties.

Thanks,
Joe


On Jun 12, 2009, at 2:12 AM, Andrus Adamchik wrote:

>
> On Jun 11, 2009, at 11:05 PM, Joe Baldwin wrote:
>
>> Question:
>> Is is possible that the Cayenne hard-coded defaults (which I read  
>> about somewhere in your docs), are over-riding my loggin.properties?
>
> Actually no. Cayenne (or your application code) would log something  
> with a certain priority. A logging framework decides whether a given  
> priority should be logged or ignored. I have very little experience  
> with the new Tomcat "juli" logger. So another random thing to try:  
> instead of OFF, can you try WARN (Cayenne logs everything with level  
> INFO, so WARN should suppress the logging).
>
> Andrus


Re: Cayenne logging

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 11, 2009, at 11:05 PM, Joe Baldwin wrote:

> Question:
> Is is possible that the Cayenne hard-coded defaults (which I read  
> about somewhere in your docs), are over-riding my loggin.properties?

Actually no. Cayenne (or your application code) would log something  
with a certain priority. A logging framework decides whether a given  
priority should be logged or ignored. I have very little experience  
with the new Tomcat "juli" logger. So another random thing to try:  
instead of OFF, can you try WARN (Cayenne logs everything with level  
INFO, so WARN should suppress the logging).

Andrus

Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
Andrus,

Well, I have been investigating the "logging.properties" strategy for  
the past couple of hours (aka hacking).  I have been slightly  
successful.

The Tomcat 6 docs (as best as I can decipher) recommend creating a  
file called "logging.properties".  In this file in the WEB-INF/classes  
directory.  I perused their example and created the following  
logging.properties file:

	handlers = org.apache.juli.FileHandler
	org.apache.juli.FileHandler.directory = ${catalina.base}/logs/mywebapp
	org.apache.juli.FileHandler.prefix = mywebapp.

When I do this, all of the Cayenne logs are redirected to the $ 
{catalina.base}/logs/mywebapp/mywebapp.<date>.log

However, I still cannot control the cayenne logging.  I have tried a  
number of property directives (including ".QueryLogger=OFF"), but the  
log still contains the "INFO" level logs for the cayenne.QueryLogger.

Question:
Is is possible that the Cayenne hard-coded defaults (which I read  
about somewhere in your docs), are over-riding my loggin.properties?

Thanks,
Joe





On Jun 11, 2009, at 12:12 PM, Andrus Adamchik wrote:

> Don't remember in what context the .cayenne advice was given, but it  
> is certainly not applicable here. In case of web application,  
> there's many ways to catch the "startup" moment. Like within a  
> servlet or filter init method, or a listener - check the  
> javax.servlet package JavaDocs.
>
> Now, in a container environment (such as Tomcat), I would go a step  
> further, and delegate all the logging config setup to the container,  
> using container-specific methods. I am mostly working with Jetty so  
> my Tomcat experience is a bit dated, but check the logging docs of  
> the version of Tomcat you are using. It should have suggestions on  
> setting up logging (which is no longer Log4J based).
>
> Sorry for giving such a generic advice. There's too many environment  
> specific details in the J2EE world to give just a single fit-all  
> recipe.
>
> Andrus
>
> On Jun 11, 2009, at 7:01 PM, Joe Baldwin wrote:
>
>> 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
>>>>>
>>>>
>>>
>>
>>
>


Re: Cayenne logging

Posted by Andrus Adamchik <an...@objectstyle.org>.
Don't remember in what context the .cayenne advice was given, but it  
is certainly not applicable here. In case of web application, there's  
many ways to catch the "startup" moment. Like within a servlet or  
filter init method, or a listener - check the javax.servlet package  
JavaDocs.

Now, in a container environment (such as Tomcat), I would go a step  
further, and delegate all the logging config setup to the container,  
using container-specific methods. I am mostly working with Jetty so my  
Tomcat experience is a bit dated, but check the logging docs of the  
version of Tomcat you are using. It should have suggestions on setting  
up logging (which is no longer Log4J based).

Sorry for giving such a generic advice. There's too many environment  
specific details in the J2EE world to give just a single fit-all recipe.

Andrus

On Jun 11, 2009, at 7:01 PM, Joe Baldwin wrote:

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


Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
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
>>>
>>
>


Re: Cayenne logging

Posted by Andrus Adamchik <an...@objectstyle.org>.
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
>>
>


Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
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
>


Re: Cayenne logging

Posted by Andrus Adamchik <an...@objectstyle.org>.
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


Re: Cayenne logging

Posted by Joe Baldwin <jf...@earthlink.net>.
I am having the same problem.  The docs say that you can use either  
but they do not going into sufficient detail (as a primer) so that I  
can control it. If anyone has be able to do this with 3.0M6, I would  
appreciate a simple example.

Thanks,
Joe


On Jun 11, 2009, at 10:21 AM, Aristedes Maniatis wrote:

> On 12/6/09 12:13 AM, Jason Ward wrote:
>>
>> log4j.logger.org.objectstyle.cayenne = OFF
>> log4j.logger.org.objectstyle.cayenne.access.QueryLogger = OFF
>> log4j.logger.org.objectstyle.cayenne.conf = OFF
>> log4j.logger.org.objectstyle.cayenne.util = OFF
>
> Note that the packaging changed from org.objectstyle to org.apache  
> with Cayenne 2.x. That is probably your problem.
>
> Ari Maniatis


Re: Cayenne logging

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 12/6/09 12:13 AM, Jason Ward wrote:
>
> log4j.logger.org.objectstyle.cayenne = OFF
> log4j.logger.org.objectstyle.cayenne.access.QueryLogger = OFF
> log4j.logger.org.objectstyle.cayenne.conf = OFF
> log4j.logger.org.objectstyle.cayenne.util = OFF

Note that the packaging changed from org.objectstyle to org.apache with Cayenne 2.x. That is probably your problem.

Ari Maniatis