cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Cayenne logging
Date Thu, 11 Jun 2009 16:12:19 GMT
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
>>>>
>>>
>>
>
>


Mime
View raw message