You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Scott Melcher <sm...@assistcorp.com> on 2003/12/11 17:42:53 UTC
RE: Log based on object and not the class - Solution
Ceki,
Thats an excellent solution. It's not very intrusive to the application.
I pay the expense of an extra method call but the benefits probably outweigh
the cost.
Thank you very much.
-----Original Message-----
From: Ceki Gülcü [mailto:ceki@qos.ch]
Sent: Thursday, December 11, 2003 9:27 AM
To: Log4J Users List
Subject: RE: Log based on object and not the class
Scott,
I just committed a possible solution to the problem you raised.
You can look at it here:
http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/examples/objectBased/
Does it solve the problem?
At 08:56 AM 12/11/2003 -0700, you wrote:
>I considered doing something like you suggested but I just hate to add code
>in order to handle logging. Our application is very large and I would have
>to add some object layers in order to get it to work. It seems like
>overkill. For now I may just put external filters on my application that
>simply display the messages I am interested in.
>
>Thanks for the response.
>
>-----Original Message-----
>From: steve.beech@xks.co.uk [mailto:steve.beech@xks.co.uk]
>Sent: Thursday, December 11, 2003 8:47 AM
>To: Log4J Users List
>Subject: Re: Log based on object and not the class
>
>
>Scott,
>
>Why not add a switch parameter to the parent method?
>
>i.e
>
>Class Parent {
> ...
> Public void myMethod(boolean b) {
> if (b==true) {
> Logger.debug("logging message");
> }
> }
>}
>
>Class Child1 extends Parent {
> ...
> Public void execute1() {
> this.myMethod(true);
> }
>}
>
>Class Child2 extends Parent {
> ...
> Public void execute2() {
> this.myMethod(false);
> }
>}
>
>Steve
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org