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
Pass the child object's Logger in to the parent method.
-Original Message-
From: Scott Melcher [mailto:[EMAIL PROTECTED]
Sent: 11 December 2003 15:47
To: 'Log4J Users List'
Subject: Log based on object and not the class
Hi, my problem is that in my object architecture/hierarchy I have
that
simply display the messages I am interested in.
Thanks for the response.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
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
: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
I use something like this:
public class Parent
{
protected Logger log = Logger.getLogger(getClass());
public void myMethod()
{
log.debug(logging message);
}
}
public class Child1 extends Parent
{
public void execute1()
{
myMethod();
}
}
public class Child2 extends
I have a couple of thoughts for you, but both violate at least one restriction you
placed on the solution! The ideas may lead you to something better than you currently
have though.
1) Use Template Method pattern.
You mentioned not wanting to change code, and this solution does require that.