You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Hernán Pablo Leandro Seoane <hs...@gmail.com> on 2009/01/15 20:00:19 UTC

Log4j - Logging a single method

Hi everyone,
I'm trying to configure Log4j so that the output of the logger for a
specific method of a certain class goes to a separate file.
I know that it can be configured to log a specific package or class, but is
it possible to push it down to a method level?

Thanks!
Hernan

Re: Log4j - Logging a single method

Posted by Hernán Pablo Leandro Seoane <hs...@gmail.com>.
But there's nothing to configure it in a way like this?
log4j.logger.my.package.MyClass.theMethod=ERROR, MyErrorFile

Thanks!
Hernan

On Thu, Jan 15, 2009 at 5:05 PM, Hanson Char <ha...@gmail.com> wrote:

> I guess it's possible, but would be expensive since that would entail
> examining the call stack.
>
> Hanson
>
> On Thu, Jan 15, 2009 at 11:00 AM, Hernán Pablo Leandro Seoane <
> hseoane@gmail.com> wrote:
>
> > Hi everyone,
> > I'm trying to configure Log4j so that the output of the logger for a
> > specific method of a certain class goes to a separate file.
> > I know that it can be configured to log a specific package or class, but
> is
> > it possible to push it down to a method level?
> >
> > Thanks!
> > Hernan
> >
>

Re: Log4j - Logging a single method

Posted by Hanson Char <ha...@gmail.com>.
I guess it's possible, but would be expensive since that would entail
examining the call stack.

Hanson

On Thu, Jan 15, 2009 at 11:00 AM, Hernán Pablo Leandro Seoane <
hseoane@gmail.com> wrote:

> Hi everyone,
> I'm trying to configure Log4j so that the output of the logger for a
> specific method of a certain class goes to a separate file.
> I know that it can be configured to log a specific package or class, but is
> it possible to push it down to a method level?
>
> Thanks!
> Hernan
>

Re: Log4j - Logging a single method

Posted by Robert Christian <ro...@gmail.com>.
It may be simple enough just to encapsulate the method with a new class, if
you have access to the source code.

On Thu, Jan 15, 2009 at 12:35 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> You'd probably get a better answer on a log4j list. If you have the ability
> to modify the source then I would just have that method get its own Logger.
>
>
> On Jan 15, 2009, at 11:00 AM, Hernán Pablo Leandro Seoane wrote:
>
>  Hi everyone,
>> I'm trying to configure Log4j so that the output of the logger for a
>> specific method of a certain class goes to a separate file.
>> I know that it can be configured to log a specific package or class, but
>> is
>> it possible to push it down to a method level?
>>
>> Thanks!
>> Hernan
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: Log4j - Logging a single method

Posted by Ralph Goers <ra...@dslextreme.com>.
You'd probably get a better answer on a log4j list. If you have the  
ability to modify the source then I would just have that method get  
its own Logger.

On Jan 15, 2009, at 11:00 AM, Hernán Pablo Leandro Seoane wrote:

> Hi everyone,
> I'm trying to configure Log4j so that the output of the logger for a
> specific method of a certain class goes to a separate file.
> I know that it can be configured to log a specific package or class,  
> but is
> it possible to push it down to a method level?
>
> Thanks!
> Hernan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org