[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] Redirect LogChannel for log4j



Bom diaz Uwe,

Hi xmlBlaster Developer,

I am developing a application that uses Log4J. The xmlBlaster client classes are used in this project.

Now xml Blaster has its own logging. I would like, that the xmlblaster
loggings would appear in my log4j files. The xmlBlaster (jutils) LogChannel has a super feature. I can define a


Honour to Juergen Birkle ...

callback Interface, so all log calls can be caught and manipulated, e.g.
like this:


public class c implements org.jutils.log.LogableDevice {
/**
* Event fired by LogChannel.java through interface LogableDevice.
* <p />
* Log output into our Category <br />
*/
public void log(int level, String source, String str)
{
final Category log = org.apache.log4j.Category.getInstance("org.xmlblaster");


StringBuffer logTxt = new StringBuffer();
logTxt.append("[");
logTxt.append(source);
logTxt.append("] ");
logTxt.append(str);
switch (level) {
case LogChannel.LOG_CALL:
case LogChannel.LOG_DUMP:
case LogChannel.LOG_TIME: case LogChannel.LOG_TRACE: if (log.isDebugEnabled())
log.debug(logTxt);
break; case LogChannel.LOG_ERROR: log.error(logTxt);
break; case LogChannel.LOG_INFO: log.info(logTxt);
break; case LogChannel.LOG_WARN: log.warn(logTxt);
break; default:
log.info(logTxt);
break; };
} }


Cool!


Now I have a problem with initializing. I have to get all LogChannels,
that are used by Global, without knowing the ids. But there exists no appropriate method. If I would have it, e.g. Enumeration Global.getLogs(), I could
initialize all Channels by adding my Interceptor.


Perhaps you can add it.

Please just add it yourself and commit it to xmlBlaster.org

thanks,

Marcel


Thank you and many greetings


Uwe