You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by "Musall, Maik" <ma...@selbstdenker.ag> on 2017/02/16 20:53:40 UTC

Switching SQL logging on/off at runtime

Hi all,

like recommended in https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use these properties to control the logging of SQL:

log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
log4j.logger.org.apache.cayenne = WARN

How would I switch SQL logging on from within the application at runtime?

Thanks
Maik


Re: Switching SQL logging on/off at runtime

Posted by Michael Gentry <bl...@gmail.com>.
Ours allows us to specify an arbitrary string, too, in case we forget a
logger or need to fine-tune it more.  Just a suggestion.  :-)


On Fri, Feb 17, 2017 at 9:29 AM, Musall, Maik <ma...@selbstdenker.ag> wrote:

> Hi Michael,
>
> I have a similar thing in mine, but somehow the Cayenne loggers weren't
> included in that list yet.
>
> Maik
>
>
> > Am 17.02.2017 um 14:39 schrieb Michael Gentry <bl...@gmail.com>:
> >
> > Hi Maik,
> >
> > One thing we put in the administrative pages for all of our applications
> is
> > the ability to set logger levels at runtime (not just Cayenne, but any of
> > them).  Allows us to have a "reasonable" default most of the time,
> > especially in production, but then be able to change dynamically if we
> need
> > to troubleshoot.
> >
> > mrg
> >
> >
> > On Thu, Feb 16, 2017 at 4:53 PM, Musall, Maik <ma...@selbstdenker.ag>
> wrote:
> >
> >> Of course, thanks. Works!
> >>
> >>> Am 16.02.2017 um 21:22 schrieb John Huss <jo...@gmail.com>:
> >>>
> >>> Use the log4j api.  Something like RootLogger.getLogger("org.
> >> apache.cayenn
> >>> e.access.QueryLogger").setLevel(Level.INFO)
> >>>
> >>> On Thu, Feb 16, 2017 at 2:53 PM Musall, Maik <ma...@selbstdenker.ag>
> >> wrote:
> >>>
> >>>> Hi all,
> >>>>
> >>>> like recommended in
> >>>> https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use
> >> these
> >>>> properties to control the logging of SQL:
> >>>>
> >>>> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
> >>>> log4j.logger.org.apache.cayenne = WARN
> >>>>
> >>>> How would I switch SQL logging on from within the application at
> >> runtime?
> >>>>
> >>>> Thanks
> >>>> Maik
> >>>>
> >>>>
> >>
> >>
>
>

Re: Switching SQL logging on/off at runtime

Posted by "Musall, Maik" <ma...@selbstdenker.ag>.
Hi Michael,

I have a similar thing in mine, but somehow the Cayenne loggers weren't included in that list yet.

Maik


> Am 17.02.2017 um 14:39 schrieb Michael Gentry <bl...@gmail.com>:
> 
> Hi Maik,
> 
> One thing we put in the administrative pages for all of our applications is
> the ability to set logger levels at runtime (not just Cayenne, but any of
> them).  Allows us to have a "reasonable" default most of the time,
> especially in production, but then be able to change dynamically if we need
> to troubleshoot.
> 
> mrg
> 
> 
> On Thu, Feb 16, 2017 at 4:53 PM, Musall, Maik <ma...@selbstdenker.ag> wrote:
> 
>> Of course, thanks. Works!
>> 
>>> Am 16.02.2017 um 21:22 schrieb John Huss <jo...@gmail.com>:
>>> 
>>> Use the log4j api.  Something like RootLogger.getLogger("org.
>> apache.cayenn
>>> e.access.QueryLogger").setLevel(Level.INFO)
>>> 
>>> On Thu, Feb 16, 2017 at 2:53 PM Musall, Maik <ma...@selbstdenker.ag>
>> wrote:
>>> 
>>>> Hi all,
>>>> 
>>>> like recommended in
>>>> https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use
>> these
>>>> properties to control the logging of SQL:
>>>> 
>>>> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
>>>> log4j.logger.org.apache.cayenne = WARN
>>>> 
>>>> How would I switch SQL logging on from within the application at
>> runtime?
>>>> 
>>>> Thanks
>>>> Maik
>>>> 
>>>> 
>> 
>> 


Re: Switching SQL logging on/off at runtime

Posted by Michael Gentry <bl...@gmail.com>.
Hi Maik,

One thing we put in the administrative pages for all of our applications is
the ability to set logger levels at runtime (not just Cayenne, but any of
them).  Allows us to have a "reasonable" default most of the time,
especially in production, but then be able to change dynamically if we need
to troubleshoot.

mrg


On Thu, Feb 16, 2017 at 4:53 PM, Musall, Maik <ma...@selbstdenker.ag> wrote:

> Of course, thanks. Works!
>
> > Am 16.02.2017 um 21:22 schrieb John Huss <jo...@gmail.com>:
> >
> > Use the log4j api.  Something like RootLogger.getLogger("org.
> apache.cayenn
> > e.access.QueryLogger").setLevel(Level.INFO)
> >
> > On Thu, Feb 16, 2017 at 2:53 PM Musall, Maik <ma...@selbstdenker.ag>
> wrote:
> >
> >> Hi all,
> >>
> >> like recommended in
> >> https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use
> these
> >> properties to control the logging of SQL:
> >>
> >> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
> >> log4j.logger.org.apache.cayenne = WARN
> >>
> >> How would I switch SQL logging on from within the application at
> runtime?
> >>
> >> Thanks
> >> Maik
> >>
> >>
>
>

Re: Switching SQL logging on/off at runtime

Posted by "Musall, Maik" <ma...@selbstdenker.ag>.
Of course, thanks. Works!

> Am 16.02.2017 um 21:22 schrieb John Huss <jo...@gmail.com>:
> 
> Use the log4j api.  Something like RootLogger.getLogger("org.apache.cayenn
> e.access.QueryLogger").setLevel(Level.INFO)
> 
> On Thu, Feb 16, 2017 at 2:53 PM Musall, Maik <ma...@selbstdenker.ag> wrote:
> 
>> Hi all,
>> 
>> like recommended in
>> https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use these
>> properties to control the logging of SQL:
>> 
>> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
>> log4j.logger.org.apache.cayenne = WARN
>> 
>> How would I switch SQL logging on from within the application at runtime?
>> 
>> Thanks
>> Maik
>> 
>> 


Re: Switching SQL logging on/off at runtime

Posted by John Huss <jo...@gmail.com>.
Use the log4j api.  Something like RootLogger.getLogger("org.apache.cayenn
e.access.QueryLogger").setLevel(Level.INFO)

On Thu, Feb 16, 2017 at 2:53 PM Musall, Maik <ma...@selbstdenker.ag> wrote:

> Hi all,
>
> like recommended in
> https://cayenne.apache.org/docs/3.0/configuring-logging.html, I use these
> properties to control the logging of SQL:
>
> log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
> log4j.logger.org.apache.cayenne = WARN
>
> How would I switch SQL logging on from within the application at runtime?
>
> Thanks
> Maik
>
>