Is it better to log exception
or exception.getMessage()
while logging an info log or an error log. I'm pretty sure that is related to the context but I'd like to know from a technical perspective on which would be better for any application or if its all the same.
newcoder310
0
Junior Poster in Training
Recommended Answers
Jump to PostPersonally I always want the complete stack trace, not just the error message
Jump to Postthe error message itself is usually pointless. for all you know, some funny guy had code like this:
…try{ // code throwing whatever Exceptions } catch(AnyException aE){ throw new Exception("This message is pointless"); } catch(Exception e){ throw new Exception("Huh ... didn't see this one coming"); }
All 8 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
newcoder310
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
jwenting
1,889
duckman
Team Colleague
newcoder310
0
Junior Poster in Training
newcoder310
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.