[EMAIL PROTECTED] schrieb:

I am facing the following problem now: I wrote other classes who's methods 
become called within my transformer. But how can I output logger messages 
within these classes?
(...)

Hi Thomas,

the Avalon logger is only provided (and initialized correctly) automatically to classes when these are Avalon components.
To use an Avalon logger in non-Avalon components, you can do this:
- pass a Logger instance to the class, for example to the constructor. This is easy if you are calling it from a custom transformer, just use getLogger(). Then, call the following code before actually using the logger in that class:
   ContainerUtil.enableLogging(this, logger);
   (assuming "logger" is the instance of Logger that is passed)
- make the class extend AbstractLogEnabled. That way, you avoid having to handle the logger instance and can call getLogger() just like you would in a Cocoon/Avalon component, for example
    if (getLogger().isDebugEnabled()) getLogger().debug("hello world");

You can find some examples of this kind of usage within the Lenya code.


--
Wolfgang


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

Reply via email to