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
You can add the exception as a parameter to your log4j statement, e.g.
catch(Exception e) { logger.error("Unexpected error", e); }
Provided you've got a file appender running OK, this will output the complete stack trace of the exception.