Hi,

    I'm trying to wrap the Logger object in Log4J into a proxy object, 
call it PortletLog

So a client that wants to log would do something like this:

PortletLog log = PortletLog.getInstance(MyClass.class);

// log using same interface as Logger
log.log("blah blah");

The PortletLog class looks like this:

class PortletLog {

    // must maintain a logger for each class in a hash or something
    private static Map logMap = new Hashtable();
    private Logger logger;

    PortletLog getInstance(Clazz clazz) {
        Logger log = (Logger)logMap.get(clazz);
        if (log != null) return log;
        log = Logger.getLogger(clazz);
        logMap.put(clazz, new SportletLog(clazz));
        return log;
    }

    public void log(String msg) {
          logger.log(msg);
    }     
..

}

    So I use the portletLog to maintain as many instance of Logger 
objects as there are unique classes that wish to log. This worked fine 
until we added config information in "%F %L" in the log4j.properties 
file to get the method name and line number of the logging class. Now, 
for that data, it always gives PortletLog line 86 which is where 
PortletLog is actually doing the logging.
Is there any way of forwarding this information to the proxy object as 
well, such that it will print out the original line number and method of 
the class that logs thru PortletLog?

    Thanks, Jason



 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to