In my application i am writing a log into a file. If there is any exception thrown how can i print the stack trace into the file? I am not able to do this using the printstacktrace method over the exception object thrown. I am only able to print the exception message but not the complte stack trace. Please help me.