Jay,
Thanks a bundle, this worked great. I had one of those moments of revelation
thanks to your post - took some time to revisit streams! So, I created 2
streams, one to System.setOut, and the second to System.setErr. Now I'm
writing to sysout when I want to, and when exceptions are thrown, I get a
stack trace in the syserr log. Isn't life great!
Thanks again,
Dave

-----Original Message-----
From: Jay Burgess [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 11:45 AM
To: [EMAIL PROTECTED]
Subject: Re: JServ Apache debugging - it IS possible


Sorry to get in on this thread late.  See if the following does what you
want:

public void init(ServletConfig config) throws ServletException
{
     super.init(config);
    //
    //  Redirect standard out to a file.
    //
    try {
         BufferedOutputStream output = new BufferedOutputStream(
             new FileOutputStream(servletRoot + "/servletError.log", true));
         System.setOut(new PrintStream(output, true));
     }
    catch (Exception e) {
        logMessage(e, "An error occurred when opening the log file.");
     }
...

Jay

-----Original Message-----
From: Ross Nicoll [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 10:26 AM
To: [EMAIL PROTECTED]
Subject: Re: JServ Apache debugging


On Tue, 13 Nov 2001, Godbey, David wrote:

 > Are there any philosophical issues that I'm missing? Is the absence of
 > System.out and System.err support inside Apache/JServ by design?
If you provide your servlets with an "init (ServletConfig config)" method,
you can then use the "ServletConfig.getSevletContext ()" methd to get the
servlet's context. This provides "log (String msg)" and "log (String
msg, Throwable throwable)" methods, which may help with your problem?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to