File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes where does e.printstacktrace() write to ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "where does e.printstacktrace() write to ?" Watch "where does e.printstacktrace() write to ?" New topic
Author

where does e.printstacktrace() write to ?

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
does it write to windows console only ? can it write to a file ?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It writes only to System.err, which is the console (unless you've redefined it, which you probably don't want to do). But if you look in the API, there's an overloaded version of this method which is probably what you want. There's also a method getStackTrace() which gives you even more flexibility in what to do with the info.
[ January 30, 2008: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

With no arguments, printStackTrace() "prints this throwable and its backtrace to the standard error stream." (See java.lang.Throwable.) But the method is overloaded to also take a PrintStream or a PrintWriter.

Also note the method getStackTrace().


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

I'm not an echo. I'm just slow.
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
thank you
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by marc weber:
I'm not an echo. I'm just slow.


Good way you have dealt Marc It happens sometimes to many of us!


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where does e.printstacktrace() write to ?
 
Similar Threads
addind twice to same region in Border Layout ?
Head First SQL.
uploading file
Replace JDBC calls with webservices
Catching Servlet Exceptions