logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnson, Clay" <clay.john...@vignette.com>
Subject RE: Newbie in.help needed..(basics)
Date Wed, 11 Apr 2001 16:53:10 GMT
I looks just like the log4j Category, only I didn't expose all the methods.
Again, my purpose wasn't to isolate log4j dependency; I agree with the
earlier comment that it's just one import statement.  Rather, I wanted the
methods to use a custom hierarchy rather than the default, so I could
control the namespace within an application that might incorporate
thirdparty components that also use log4j.

So, the "wrapper" looks just like log4j Category, sans a few methods, but it
is implemented with a delegate pattern using a derived category class (I
needed additional member variables for another purpose) that also implements
CategoryFactory and holds a static, custom hierarchy.  Sort of like:

public myCategory extends Object {

// extends Category, implements CategoryFactory, uses custom hierarchy
private Delegate myDelegate; 

public static myCategory getInstance(String name) {
	myCategory cat = new myCategory();
	cat.myDelegate = (Delegate) myDelegate.getInstance(name);
	return cat;
}	

public error(String message) {
	myDeletgate.error(message);
}	
...
}

I could have had myCategory simply extend log4j Category, but there was
interest not exposing all the methods.  The delegate pattern is one way to
do that.

If you don't share these or other compelling reasons, it's not clear to me a
wrapper buys you anything.


> -----Original Message-----
> From: Ralf Krakowski [mailto:ralf.krakowski@aderagroup.com]
> Sent: Wednesday, April 11, 2001 11:17 AM
> To: 'LOG4J Users Mailing List' '
> Subject: RE: Newbie in.help needed..(basics)
> 
> 
> Clay , 
> Could you please provide a simple example of how a wrapper 
> class might look
> and how to call that class (what parameters and so on)?
> 
> Thanks
> 
> Ralf
> 
> -----Original Message-----
> From: Johnson, Clay
> To: 'LOG4J Users Mailing List'
> Sent: 2001-04-11 18:10
> Subject: RE: Newbie in.help needed..(basics)
> 
> > Has anybody had any experience with wrapping log4j?
> 
> Yes, but not for isolation.  Rather, I needed a custom hierarchy and
> category, so I was already there.  The config side is straight log4j.
>  
> > <different topic>
> > Is the 1.1beta stable enought for development?
> > </different topic>
> 
> I haven't had any problems going on a month or so.
> 
> ---------------------------------------------------------------------
> 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
> 

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


Mime
View raw message