tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trevor Luo [ITSD]" <trev...@vtc.edu.hk>
Subject Re: how to capture the errors in javabean
Date Mon, 07 Apr 2003 10:02:57 GMT
Hi, Nicholas,

Thanks for your advice. I can capture the String "Database established".
However, i changed the program a little bit to test the exception, it still fail
to capture the errors -- e.getMessages() and "test exceptin string" in
catalina.out

public void connect() throws ClassNotFoundException, SQLException, Exception {
try {
    ...
      System.out.println("Database established");

     if (ds != null) {
        con = ds.getConnection();
        }
    }catch(Exception e) {
      System.out.println("test exception string");
      System.out.println(e.getMessage());
      System.err.println(e.getMessage());
    }
}

Nicholas Orr wrote:

> Well for starters catalina.out is where, by default, all output goes to when
> you call:
> System.out.println("I'm a string of text :)");
>
> So if you were to mock up a quick JSP page "test.jsp" with the following
> code in it:
>
> Start test.jsp
> <=============>
> <%
> System.out.println("Text output from \"test.jsp\"\n\n\n\n\nText output from
> \"test.jsp\"\n\n\n\n\nText output from \"test.jsp\"");
> %>
> <html>
>   <body>
>     <h2>Test.jsp</h2>
>     <p>Check your $CATALINA_HOME/logs/catalina.out file</p>
>   </body>
> </html>
> <=============>
> End test.jsp
>
> You should get 3 lines of text with a few blank lines in between the 1st &
> 2nd and the 2nd & 3rd lines.
>
> So do this and see if you can see this text.
>
> If you can't then, there maybe another place the text is going to.
>
> Nicholas Orr
>
> -----Original Message-----
> From: Trevor Luo [ITSD] [mailto:trevorl@vtc.edu.hk]
> Sent: Monday, 7 April 2003 5:15 PM
> To: tomcat-user@jakarta.apache.org
> Subject: how to capture the errors in javabean
>
> Hi,
>
> My program has a little bug, I could not found the errors  in all log files
> under /usr/local/tomcat/logs.
>
> Can anyone teach me how to capture the errors or possible store it in a log
> file. How can i configure it at tomcat or in programming ?  I am running
> tomcat 4.1.18 in red hat linux 7.2
>
> Please note the snippet in my java bean.
>
> try {
>
>       System.out.println("Database connection established");
>       Context ctx = new InitialContext();
>       if(ctx == null )
>           throw new Exception("Boom - No Context");
>
>       DataSource ds =
> (DataSource)ctx.lookup("java:comp/env/jdbc/DBNewIntra");
>
>       if (ds != null) {
>         con = ds.getConnection();
>         }
>     }catch(Exception e) {
>       e.printStackTrace();
>     }
>
> Thank you in advance for your help!
>
> Trevor Luo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> **********************************************************************
> The information contained in this e-mail is confidential and is
> intended only for the use of the addressee(s).
> If you receive this e-mail in error, any use, distribution or
> copying of this e-mail is not permitted. You are requested to
> forward unwanted e-mail and address any problems to the
> MIM Holdings Limited Support Centre.
> For general enquires:   ++61 7 3833 8000
> Support Centre e-mail:  supportcentre@mim.com.au
> Support Centre phone:   Australia 1800500646
>                                         International ++61 7 38338042
> **********************************************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message