Hi everyone:
I want to implement a singleton
pattern while using Log4j.But what puzzle me is it need a Class as its argument while create a Logger object.For example:
Logger log=Logger.getLogger(XXX.class);
But the singleton pattern is:
///////////////////////////////////logFactory.java//////////////////
public class logfactory{
private static Logger log=null;
private logfactory(){
log=Logger.getLogger(???)
}
public static Logger getInstance(){
................what code?...... }
How I get the argument(XXX.class) to the constructor?
If I change the code to :
/////////////////////////////////////public class logfactory{
private static Logger log=null;
private logfactory(Class classname){
log=Logger.getLogger(???)
}
It can't implement what I want to.How to use singleton in Log4j?
Thks