This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes About Exception, Throwable and log files. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "About Exception, Throwable and log files." Watch "About Exception, Throwable and log files." New topic
Author

About Exception, Throwable and log files.

Leinad Nongag
Greenhorn

Joined: Aug 25, 2009
Posts: 18
Hello everybody,

I get strange issues with my stack traces and the way it's written in logs. I'm using a Struts base framework and custom tags in JSP pages, we are using Oracle JDevelopper 10g as IDE and the container is OC4J (which mean we must run our applications in JDK 1.4). The problem is when I'm logging my stack trace into the log file,instead of writing the detail of the error, it says "(check log)", but I'm already in the log file. The only time where the stacktrace is telling me the whole information is when it's happening in real time in the output window. But we don't see that window when it's running on the production server. I did change the error logging level to Trace:32 in the config files, but I still get "check log".

I'll describe scenario :

1) Somebody alter the action method name and write it wrong.

2) The DispatchAction will not found the method's name inside the Action class and will throw a NoSuchMethod exception.

3) My configuration file says that all 500 server error page must call a specific page.


Do you have any idea on how solve the problem ? I need a meaningfull stack trace, otherwise it's useless.

Thank you !

Leinad
Aditya Jha
Ranch Hand

Joined: Aug 25, 2003
Posts: 227

Without looking into your code, it's difficult, if not impossible, to help you.

How / where are you catching the exceptions you want to log? What do you do in catch block?

How do you log exceptions in the file? Do you use java.io or some logging API?
Leinad Nongag
Greenhorn

Joined: Aug 25, 2009
Posts: 18
Aditya Jha wrote:Without looking into your code, it's difficult, if not impossible, to help you.

How / where are you catching the exceptions you want to log? What do you do in catch block?

How do you log exceptions in the file? Do you use java.io or some logging API?


I do not have a specific catch, it's handled by the JSP error.jsp

<% exception.printStackTrace(); %>

I don't even know where the object Exception exception is declared. It's like using <% Object var = new Object(); session.setAttribute("var",var); %> I don't create the session object. But I can use it.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Leinad Nongag wrote:<% exception.printStackTrace(); %>

That means that the exception's stack trace is printed to the standard error stream. In Tomcat that means file stderrXXXXX.log or stdoutXXXX.log inside the logs folder.

I don't even know where the object Exception exception is declared.

It's an automatic variable like request, response or application, that's only available in pages specified to be error pages using the isErrorPage attribute of a page directive. See the bottom of http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Leinad Nongag
Greenhorn

Joined: Aug 25, 2009
Posts: 18
Rob Spoor wrote:
Leinad Nongag wrote:<% exception.printStackTrace(); %>

That means that the exception's stack trace is printed to the standard error stream. In Tomcat that means file stderrXXXXX.log or stdoutXXXX.log inside the logs folder.

I don't even know where the object Exception exception is declared.

It's an automatic variable like request, response or application, that's only available in pages specified to be error pages using the isErrorPage attribute of a page directive. See the bottom of http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html.


Thank you for the link. Saddly we are not using Tomcat for container, it's OC4J and the way the log are declared :



and



But it logs me (check logs). So it's useless since I'm already in the log.

I'm searching on the Oracle forums, but I haven't find anything yet.

I wonder if you have any idea to how fix that problems.

Thank you

Leinad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Exception, Throwable and log files.
 
Similar Threads
Weblogic error messages/logs
NX: Logging using FileHandler
Blank page in browser - "Response already committed" in logs
Cancelling a file download - "java.lang.IllegalStateException: getOutputStream() ..."
Way to display stack trace instead of 500 internal server error?