I think your problem has nothing to do with changes in the software. It's just that the logger has never been set (for cocoon components you can configure that via the logger attribute in the sitemap and/or in cocoon.xconf).
For non-Cocoon classes I would recommend using plain LogKit logging (see http://jakarta.apache.org/avalon/logkit) or the commons logging package (somewhere at jakarta) with the org.apache.commons.logging.Log system property set to org.apache.commons.logging.impl.LogKitLogger You can then configure the logging behaviour in logkit.xconf file, too. regards Judith > -----Ursprüngliche Nachricht----- > Von: Alan Hodgkinson [SMTP:[EMAIL PROTECTED]] > Gesendet am: Mittwoch, 11. September 2002 18:21 > An: Cocoon Users Mailing List > Betreff: How can I log in non-Cocoon Java classes? > > > Dear All, > > Can someone give me a hint on how to implement Cocoon logging > in Java classes that don't extend from the 'Abstract{Cocoon} > classes (I.e. AbstractAction, AbstractReader, etc.)? > > For example, how would I implement logging in a really simple > Java Bean, that otherwise wouldn't have to know anything about > cocoon? > > I had hoped that I could 'extend AbstractLogEnabled' and 'implement > LogEnabled' in my class. I've searched for clues in all the > examples, but they always extend some Cocoon-specific class (that > magically make the logging work). > > My code is roughly the following: > > import org.apache.avalon.framework.logger.AbstractLogEnabled; > import org.apache.avalon.framework.logger.LogEnabled; > import org.apache.avalon.framework.logger.Logger; > > public class MyClass > extends AbstractLogEnabled > implements LogEnabled > { > private Logger logger; > public void enableLogging(Logger logger) { > this.logger = logger; > } > > public void myMethod() { > getLogger().debug( "msg.." ); // <-- getLogger() returns null! > } > } > > The problem is that getLogger() always returns null. I suspect > that I need to implement some other interface too. > > Suggestions anyone? > > Many thanks in advance, > > Alan. > > P.S. Of course I looked in my new Carsten/Matthew 'Castle Book' > (for want of a better name), where logging is also described. > Unfortunately the logging method it recommends seems to have > been superceeded by the methods in the examples. It can get their > method to compile, but it suffers from the same 'null getLogger()' > probelm I described above. > > P.P.S. BTW: Nice book. Nicely written. But pity the software didn't > hold still :) > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>