Link to home
Start Free TrialLog in
Avatar of JFM
JFM

asked on

redirect exception output to file ?

Hi,

is it possible to redirect the output of printStackTrace(...) of Throwable to a file ?
Maybe by overriding PrintStream or PrintWriter ?

Thanks, JFM.
ASKER CERTIFIED SOLUTION
Avatar of jasbro
jasbro
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
similar to:
  PrintStream ps = new PrintStream(new FileOutputStream("error.log"));
  try{
    code that throws exception
   }
  catch(Exception e){
      e.printStackTrace(ps);
   }
Avatar of JFM
JFM

ASKER

Works good, thanks :-)