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
Look this tutorial about "File Appender"
See official Log4j short introduction and the "Configuration" section.
You can also make search about "RollingFileAppender" or "File appender".
You configure your logger to send its message to an appender. This appender can forward message towards the console (stdin), towards a file (FileAppender, RollingFileAppender...)...
Use this to perform error log:
try{
throw new Exception("bla bla bla...");
} catch( Exception e ){
// log without stack trace
mLogger.error("Your log message");
// log with stack trace
mLogger.error("Your log message", e);
}