Serilog Selflog write exception data only once to file

139 views Asked by At

I am using asp.net MVC application. In the my application, I need fetch internal exception data of the serilog. Serilog provides get the exception data from the following code:

Serilog.Debugging.SelfLog.Enable(TextWriter.Synchronized(file));
HiTrustLog.HiTrustLogger.Information(log);
Serilog.Debugging.SelfLog.Disable();

Serilog Library writes to file exception data only once and second time onwards not writing. Just, I needs it write exception data when internal exception occurs

1

There are 1 answers

0
Raju Gaddam On

The problem ILogger created only once in the global asax.cs. so , selflog writes log one time. When log event fire before create Ilogger it's works fine