Microsoft .Net has a very nice feature like First Chance Exception Log. You can easily use it in your Acumatica to log specific exceptions.
Read more about first chance exceptions.
Now I want to share with you my logger example:
To to enable this logger, you just need to put an additional file to <SitePath>App_code folder and add this line to your global.asax file:
void Application_Start(object sender, EventArgs e)
Based on this idea I have created a logger that catchs “Session Expired” messages for monitoring purposes. The source code of SessionLogger is available on GitHub.