Hi,

I am using normal EJB application on Websphere5.0 and using log4j to log messages.

When I get a SQLException, I am wrapping it into a NewException and throwing it back to the web layer. I catch the NewException in my servlet and I use the below statement to print the exception and its stack trace.

catch(NewException ne){
ne.printStackTrace();
}

Now, for the above statement, I could find the message of the exception in the log file, which is equivalent to
ne.toString() - Returns the localised message of the exception. But I could not find the stack trace of the exception below the message.

For debugging, I catch the exception in my business helper classes(EJB layer) and tried to print the stack trace using the same statement above. Then, I get the stack trace in the SystemError.log file.

I need to print the stack trace from the servlet. Can anyone let me know why the stack trace is NOT logged from the web layer?

Note1 : I dont find any problem with the code as it works fine with jboss.
Note2 : I also tried to use logger,system.out,system.err to print the exception from web layer, but in all the cases, I could see only the message without the stack trace.