Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Exception, Throwable and log files.

 
Leinad Nongag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Leinad Nongag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic