RE: Logging inside filters...

"Laird, Brian" <[email protected]> Thu, 27 Mar 2003 09:40:04 -0600
Newsgroups gmane.comp.web.jigsaw
Message-ID <[email protected]>
Minor correction:

In the example below, target.getServer().getLogger() doesn't work because=
 there is no getLogger method on ServerInterface, you need to cast it to =
the httpd class to get the actual instance of the logger.

Hope this helps,
Brian

-----Original Message-----
From: Yves Lafon [mailto:[email protected]]
Sent: Tuesday, March 18, 2003 3:54 PM
To: Laird, Brian
Cc: [email protected]
Subject: Re: Logging inside filters...


On Mon, 17 Mar 2003, Laird, Brian wrote:

>
> What is the recommended way of logging within custom built filters (ex:
> error logging)?  Is there an easy way to get a hook to the current
> logger?

From LogFilter:

            FramedResource target =3D (FramedResource) getTargetResource(=
);
            if (target !=3D null) {
                String msg =3D ("IO error while writing to log file \""+
                              ex.getMessage() + "\".");
                target.getServer().errlog(this, msg);
            }

You can get the Logger object with target.getServer().getLogger() and the=
n
use the usual method on it.
Thanks,

--=20
Yves Lafon - W3C
"Baroula que barouleras, au ti=E9u toujou t'entourneras."