You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2001/03/02 20:42:03 UTC

Re: log() ?

"Brett W. McCoy" wrote:

> On Tue, 27 Feb 2001, Shahed Ali wrote:
>
> > Sorry for this stupid question,
> > but how do I use the log() method in servlets ?
> >
> > In JSP application.log() seems to work,
> > but in servlets, I tried getServletContext().log("adad") etc and
> > I keep getting NullPointerExceptions
>

99.9% of the time, this is caused by having a method like this in your servlet:

    public void init(ServletConfig config) throws ServletException {
        ...
    }

but forgetting to call super.init(config) inside.  The easiest way to avoid
this is to convert your servlet to the no-args version of init() instead.

Craig McClanahan