Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing Exception's stacktrace  RSS feed

 
francesco raccuglia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

how can I print an exception's stacktrace with a JSFcomponent.

Actually i'm printing the exception message with a



It is working but i can't format the stacktrace like normally is done in a console.

Thanks in advance
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, there's not a whole lot of good reasons to display a stacktrace on a web page. Users can't read them, can't understand them, and don't like them. Technically-savvy people can obtain all sorts of information about what's inside the webapp, and perhaps then exploit it for evil purposes. You're better off outputting the stacktrace to a logfile. Most loggers, in fact, have a log method that can be passed the exception and the exception's stack trace will then appear in the log.

Frameworks such as Facelets can display stack information - and a whole lot more. Although, again, it's not something you really want users to see, so employ if for development, but intercept and handle the exceptions before going to production.

If, for purely academic reasons, you would like to use JSF to display a stack trace, the easiest method would be do render a datatable with a DataModel that enumerated each of the levels of the stack trace.
 
francesco raccuglia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Tim , thanks for the answer.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!