tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: logging
Date Sun, 05 May 2002 22:08:58 GMT


On Sun, 5 May 2002, Mattias Brändström wrote:

> Date: Sun, 05 May 2002 14:42:28 +0200
> From: Mattias Brändström <brasse@ludd.luth.se>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: logging
>
> Hi!
>
> Now I have yet another question. =)
>
> How can I write log messages to some kind of log (preferably the one
> specified by the Logger element) in a JSP-page. I have tried to write to
>   both System.err and System.out but nothing ends up in my log file. Is
> there some special way to obtain a 'logger' object or is there some
> settings in server.xml that I have missed?
>

In a servlet, anything logged with the ServletContext.log() method goes to
the file that is configured with the <Logger> element.  That means, from a
JSP page, that you'd have to use a scriptlet something like this:

<%
  application.log("Hello, world!");
%>

since the default "application" object is, in fact, the ServletContext
object for your webapp.

> Any help would be greatly appriciated!
>
> Regards,
> Mattias
>
> PS. My server.xml file is attached.
>

Craig


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message