Is there any way to write error log or exception into a file in java. i have gone through Log4j. I googled about it but diidnt find a good solution. I have written a simple code
catch (Exception e) {
PrintWriter pw = new PrintWriter(new FileOutputStream("Log"));
e.printStackTrace(pw);
}
Is there any other way to log the errors or exception? can any body provide me wwith sample example of Log4j?
Source: Stackoverflow.com