Hi, i'm trying to add a exception handler wich will log the exception (in umbraco logs). How could this be done ?
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseExceptionHandler(err => {
app.Run(async context =>
{
// How can I log the error ?
});
});
I have tried, without success, adding ILogger to Configure method parameters.
I think what you need to do is add the ILogger as a parameter in the constructor assign that to a private class variable which you can then access in the Configure method.
How to log in ExceptionHandler ?
Hi, i'm trying to add a exception handler wich will log the exception (in umbraco logs). How could this be done ?
I have tried, without success, adding ILogger to Configure method parameters.
Thank you
Hi Alexandre,
here's the official docs:
https://our.umbraco.com/Documentation/Fundamentals/Code/Debugging/Logging/
I think what you need to do is add the ILogger as a parameter in the constructor assign that to a private class variable which you can then access in the Configure method.
You are right, the following constructor in Startup.cs works :
Thank you
is working on a reply...