Return-Path: Delivered-To: apmail-xml-cocoon-users-archive@xml.apache.org Received: (qmail 35879 invoked by uid 500); 11 Sep 2002 15:14:46 -0000 Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-users@xml.apache.org Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 35799 invoked from network); 11 Sep 2002 15:14:46 -0000 Sender: alan@softxs.ch Message-ID: <3D7F6D81.AC6544F5@softxs.ch> Date: Wed, 11 Sep 2002 16:21:21 +0000 From: Alan Hodgkinson Reply-To: alan.hodgkinson@alum.mit.edu Organization: SoftXS GmbH X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.5-15 i586) X-Accept-Language: en MIME-Version: 1.0 To: Cocoon Users Mailing List Subject: How can I log in non-Cocoon Java classes? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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. To unsubscribe, e-mail: For additional commands, e-mail: