Thanks for the response Jaikiran, the method with Throwable as argument is working fine
One more problem which I have to resolve. In the code, many times exception may come which has not been handled. I want in case of any exception the track trace should get printed to the log file, the way its done on the console. Is this possible with Log4j?