Shakti Singh

Shakti Singh

  • NA
  • 9
  • 542

Application_BeginRequest didn't fire for few request in MVC

Jun 1 2021 11:19 AM
In our API when we are writing the logs we are adding ActivityId. It is created in Application_BegingRequest but for few call it didn't write any ActivityId and it seems it did not fire Application_BeginRequest method in Global.asax.
Please find the details below :
 
Code in Global.asax:
 
protected void Application_BeginRequest(object sender, EventArgs e)
{
Trace.CorrelationManager.ActivityId = Guid.NewGuid();
}
configuration for logs:
 
<target name="logfile" xsi:type="File" fileName="./Logs/${shortDate}.log" layout="${time} | ${activityid} | ${identity} | ${callsite:className=true:includeSourcePath=true:methodName=true:includeNamespace=false} | ${level:uppercase=true} | ${message} ${exception}" />
Sceenshot of logs:
 
 
 can some please help me on this issue.