Re: Log based on object and not the class

2003-12-11 Thread steve . beech
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

RE: Log based on object and not the class

2003-12-11 Thread Adrian Janssen
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

RE: Log based on object and not the class

2003-12-11 Thread Scott Melcher
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

RE: Log based on object and not the class - Solution

2003-12-11 Thread Scott Melcher
: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

RE: Log based on object and not the class

2003-12-11 Thread Andy McBride
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

RE: Log based on object and not the class

2003-12-11 Thread Jensen, Jeff
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.