You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lawrence Gerstley <la...@gmail.com> on 2009/09/24 21:37:27 UTC

Set a query logging level

Hi,

I've been searching through documentation and Googling for some time  
to see how to elevate the logging level of an individual query, and  
came across the type of function is was looking for, but which seems  
to be more hypothetical than real (i.e., it's not in the Query object):

SelectQuery sq = new SelectQuery(Some.class);
sq.setLoggingLevel("INFO");

I've got log4j working in 3.0 and the configuration file working just  
fine. Is there some simple example of elevating just one query.

Also, just an FYI: the Wiki link on the home page seems to be quite  
dead.

Thanks in advance,

Lawrence


Re: Set a query logging level

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 25/09/09 5:37 AM, Lawrence Gerstley wrote:
> Also, just an FYI: the Wiki link on the home page seems to be quite dead.

I've been trying to fix it, but something in the Confluence exporter is just breaking it every time.  Argh...

Ari

-- 

-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: Set a query logging level

Posted by Andrus Adamchik <an...@objectstyle.org>.
Ah yeah, this paragraph is obsolete. We need to take it out.

You can achieve the same effect by adding a manual logging statement  
in your code prior to specific query execution, and the check the  
following QueryLogger entry in the same thread for the actual query SQL.

Andrus


On Sep 25, 2009, at 12:06 AM, Lawrence Gerstley wrote:

> Just following the earlier documentation, and trying to describe to  
> a team how they can elevate an individual query for debugging  
> purposes.  To whit (from the 2.0 documentation):
>
> When SQL tracing is turned off, it is possible to log the execution  
> of only certain queries or commits by manually increasing the  
> logging level of just a specific query above the level configured  
> for the QueryLogger. This is a very convenient feature for debugging  
> the code, since it reduces the level of noise in the logs, focusing  
> attention on the queries that are important. This API is discussed  
> in the FAQ.  (see: http://cayenne.apache.org/doc20/configuring-logging.html)
>
> I agree that this would be useful in our scenario, when we're  
> working on tuning performance, working on best use of prefetching,  
> etc. So that was my interest, now that I have log4j working correctly.
>
> On Sep 24, 2009, at 12:48 PM, Andrus Adamchik wrote:
>
>> Per query logging levels existed in the early versions of Cayenne,  
>> but got killed quite some time ago. IMO, though occasionally  
>> convenient, this goes against good logging practices. What case are  
>> you trying to address with it?
>>
>> Andrus
>>
>>
>> On Sep 24, 2009, at 10:37 PM, Lawrence Gerstley wrote:
>>> Hi,
>>>
>>> I've been searching through documentation and Googling for some  
>>> time to see how to elevate the logging level of an individual  
>>> query, and came across the type of function is was looking for,  
>>> but which seems to be more hypothetical than real (i.e., it's not  
>>> in the Query object):
>>>
>>> SelectQuery sq = new SelectQuery(Some.class);
>>> sq.setLoggingLevel("INFO");
>>>
>>> I've got log4j working in 3.0 and the configuration file working  
>>> just fine. Is there some simple example of elevating just one query.
>>>
>>> Also, just an FYI: the Wiki link on the home page seems to be  
>>> quite dead.
>>>
>>> Thanks in advance,
>>>
>>> Lawrence
>>>
>>>
>>
>


Re: Set a query logging level

Posted by Lawrence Gerstley <la...@gmail.com>.
Just following the earlier documentation, and trying to describe to a  
team how they can elevate an individual query for debugging purposes.   
To whit (from the 2.0 documentation):

When SQL tracing is turned off, it is possible to log the execution of  
only certain queries or commits by manually increasing the logging  
level of just a specific query above the level configured for the  
QueryLogger. This is a very convenient feature for debugging the code,  
since it reduces the level of noise in the logs, focusing attention on  
the queries that are important. This API is discussed in the FAQ.   
(see: http://cayenne.apache.org/doc20/configuring-logging.html)

I agree that this would be useful in our scenario, when we're working  
on tuning performance, working on best use of prefetching, etc. So  
that was my interest, now that I have log4j working correctly.

On Sep 24, 2009, at 12:48 PM, Andrus Adamchik wrote:

> Per query logging levels existed in the early versions of Cayenne,  
> but got killed quite some time ago. IMO, though occasionally  
> convenient, this goes against good logging practices. What case are  
> you trying to address with it?
>
> Andrus
>
>
> On Sep 24, 2009, at 10:37 PM, Lawrence Gerstley wrote:
>> Hi,
>>
>> I've been searching through documentation and Googling for some  
>> time to see how to elevate the logging level of an individual  
>> query, and came across the type of function is was looking for, but  
>> which seems to be more hypothetical than real (i.e., it's not in  
>> the Query object):
>>
>> SelectQuery sq = new SelectQuery(Some.class);
>> sq.setLoggingLevel("INFO");
>>
>> I've got log4j working in 3.0 and the configuration file working  
>> just fine. Is there some simple example of elevating just one query.
>>
>> Also, just an FYI: the Wiki link on the home page seems to be quite  
>> dead.
>>
>> Thanks in advance,
>>
>> Lawrence
>>
>>
>


Re: Set a query logging level

Posted by Andrus Adamchik <an...@objectstyle.org>.
Per query logging levels existed in the early versions of Cayenne, but  
got killed quite some time ago. IMO, though occasionally convenient,  
this goes against good logging practices. What case are you trying to  
address with it?

Andrus


On Sep 24, 2009, at 10:37 PM, Lawrence Gerstley wrote:
> Hi,
>
> I've been searching through documentation and Googling for some time  
> to see how to elevate the logging level of an individual query, and  
> came across the type of function is was looking for, but which seems  
> to be more hypothetical than real (i.e., it's not in the Query  
> object):
>
> SelectQuery sq = new SelectQuery(Some.class);
> sq.setLoggingLevel("INFO");
>
> I've got log4j working in 3.0 and the configuration file working  
> just fine. Is there some simple example of elevating just one query.
>
> Also, just an FYI: the Wiki link on the home page seems to be quite  
> dead.
>
> Thanks in advance,
>
> Lawrence
>
>