Log Yellow Screen. Is this possible with NLOG?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Log Yellow Screen. Is this possible with NLOG?


I am using a "Divide by Zero" exception to try to save on a database the data that appears in the Yellow Screen:

      Int32 a = 0; Int32 b = 1;
      Int32 c = b / a;

I am using the following parameters:

      <parameter name="@Logger" layout="${logger}" />
      <parameter name="@Message" layout="${message}" />     
      <parameter name="@Source" layout="${callsite:className=true:fileName=false:includeSourcePath=false:methodName=true}" />
      <parameter name="@Stack" layout="${exception:format=stacktrace}" />
      <parameter name="@Type" layout="${exception:format=type}" />   

Both Stack and Type are always empty. I am not sure why.

Do I need to build the message when I log it using exception data?

Basically the yellow screen has the following fields which I would like to log:

Attempted to divide by zero.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.DivideByZeroException: Attempted to divide by zero.

Source Error:
Line 48:       Int32 b = 1;
Line 50:       Int32 c = b / a;

Source File: C:\Projects\NLOGTest\HomeController.cs    Line: 50

Stack Trace:
[DivideByZeroException: Attempted to divide by zero.]

Is there a way to do this?

Thank You,