[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Please help: JServ logging not solved yet

Andreas Tille wrote:

> OK, I could try that but what about the claiming that there is no
> method log() in GenericServlet?  Looking into the definition of
> GenericServlet in the Servlet 2.1 API doc and also in GenericServlet.java
> i can see clearly its definition.

Humm I can't see log() method in class GenericServlet nor field log see:

Clear, it's 2.2 API and you use 2.0 API.

[...thinking in progress...]

Arrg, Tom's solution may not work with servlet as System.setErr() and
System.setOut() call security manager as describe in

Let's try that class (not tested)

public class LogThruServlet extends PrintStream {
    private GenericServlet gs;

    public LogThruServlet (GenericServlet gs) {
	/* dummy initialisation of super classes */
	super (new OutputStream() {
	       public void write(int b) throws IOException {
	       /* Do nothing */
	this.gs = gs;

    public void print(String s) {

Then, in your servlet (may be in a constructor) add:
    PrintStream log = new LogThruServlet (this);

Hope this help.
Edouard G. Parmelan

Reply to: