Asp.Net Core ILogger and Serilog.Sinks.Email #6
Unanswered
chrisklepeis
asked this question in
Q&A
Replies: 1 comment
-
Glad you got it working sir! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure how to get this working with the built in ILogger in ASP.Net Core or if it can even integrate with the Serilog.Sinks.Email package.
Then in my controller I try:
_logger.LogError("Error occured", ex); // where _logger is the ILogger from ASP.Net Core, not Serilog..
I do get the email, but nothing related to an exception.
Maybe we need an Asp.Net Core extension method for ILogger to call Error, passing the exception. Just a thought. I'm using Serilog for ASP.Net Core from the readme here https://github.com/serilog/serilog-extensions-logging
Edit... found out I was using the wrong override of "LogError"
_logger.LogError(new EventId(1, "Error"), ex, "Error");
works.
Beta Was this translation helpful? Give feedback.
All reactions