This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging stack trace

 
Mikael MÃ¥nsson
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using the standard java logger, and i'm wondering about stack traces.

Normally, not using a logger, i would propagate all lower level exceptions as higher level exceptions up to the last place, the gui, and there I would present the user with an understandable error message. At the same time, for debugging, i would want to call the printstacktrace method on the exception so that I can see in what file and what line the exception occured.

Now, when I am using the logger, I would want to log both the message from the error and the stack trace for the same kind of tracability, but i don't find any simple way of doing this, is this not a common thing to do?

 
Roel De Nijs
Sheriff
Posts: 9159
76
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mikael,

Logging is not a requirement, so I didn't logged any error. The only logging is used was some helpful debug information (parameters and return value of each method from the Data class and my business service).

To show the user a message I used this code:
And maybe this link can help you to log an exception using JUL.

Kind regards,
Roel
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic