Re: logging from a helper

Gene McCullough <[email protected]> Mon, 03 May 2004 10:20:57 -0500
Newsgroups gmane.comp.java.keel.user
Message-ID <[email protected]>
I've tried this, without success.  Maybe you can see where i went
astray.

I've created a HelperBase that extends AbstractHelper, and added
logging:

<snip>
...
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
...
public class HelperBase extends AbstractHelper implements LogEnabled  {
	
	protected Logger log = null;

   /**
     * @see
org.apache.avalon.framework.logger.LogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
     */
    public void enableLogging(Logger logger) {
        log = logger;
    }
...
}

<snip/>

then, my helper has:

<snip>

public class MyHelper extends HelperBase {

	public void testLogging(){
		//if(log.isDebugEnabled())
			log.info("It worked!");
	}
...
}
<snip/>


I get a NPE exception when trying to execute testLogging from my model.
I'm thinking at this point I haven't got the logkit (which is what I'm
using since it is default) configured properly, but I'm not sure what I
need to add where.

thanks again
gene

On Tue, 2004-04-27 at 13:41, gene wrote:
> Is there an easy way for my helper class to log to the persistent
> logger?
> 
> TIA
> gene
> 
> _______________________________________________
> User mailing list
> [email protected]
> http://lists.keelframework.org/listinfo.cgi/user-keelframework.org