How to log exception into text file

How to log exception into text file

Hello All,

I like to maintain exception logs into text file as well as database tables. Can anyone please tell me how to maintain exception logs.

Thanks & Regards,
 Pradeep Chavan
All the exception logs have been managed by platform in different entities like OSLOG_ERROR and many more .You can use these entities to show logs whereever you want , aslo at runtime you can find exception in session exception veriable and can use file io to write this information in any file.
Hello Pramod,

Thank you for your valuable reply but can you please elaborate it. Where and how we can log exceptions into database or text file.
depeneds upon your  requirmnet means where all you want to keep logs in file you can do it.Whenever a error has been raised by the application you can jsut write Session.ExceptionMessage value in file . This session varibale explained the reason for the last raised error.
Also you can write anything you want in the file using filesystem extension which gives you methods for performing IO operation over file.

Really don't recommend logging to a text file. It means that in a multi-server environment you need to look at ALL of the servers to find the log records.

Just use the "Audit" action in System, that logs to the General log.

Thats true platform does it for you automatically and additionaly you can use Audit for writing any customized log.
My intension was just to let him know that almost everything is possible with the platform .

can we able to catch multiple exception. eg
I have one database query which through an 2-3 types of database error like invalid number,timeout exception.So i want to show user friendly message when exception like timeout and invalid number this all is within single exception.

Yes yo can have multiple exception block for catching different type of exception like User exception , Db Exception etc. And once you catch pertivuler type of error you can parse the error text and can show user friendly error messages.