Comments (11)
Thanks for the report. I haven't encountered this, may need some investigation. Help welcome, if you're able to build from source and take a look.
Which Serilog version are you running, and to which sink(s)? Thanks!
from classic.
I am using the Seq sink. I was using outdated versions of these packages. I have now updated them and am using Serilog 2.2.1 and Serilog.Sinks.Seq 3.0.1. The 500 errors are now coming through on Seq but have no exception data and are only logging as Information level, which is not very helpful as it has no context of the error (stack trace/line numbers etc).
from classic.
Sounds like progress! Glad to hear you have some data captured now.
Can you please send an example of one of the events received at Seq? Particularly the message associated with the event - redacted if necessary of course. Any information about associated properties on the event would also help to debug this on this end. Thanks!
from classic.
Here's an example of a log message we are seeing in Seq
from classic.
Thanks for the info. I think what's probably happening here (at a guess) is that another handler/exception filter is handling the exception. Are there any other error-handling paths that might prevent the exception from bubbling up?
I've just merged #31 to switch the level to Error appropriately in this scenario, if you have a chance to grab the 2.0.10 build and check it out.
from classic.
Thanks for the speedy fix for that, seems to be logging with Error level now for 500 server errors, even with no exception data.
Regarding capturing exception data, I am using the setup in web.config. I have worked out just now that exception info is captured for local requests but not remote ones. Any ideas what may be causing this? I though maybe there was a in the web.config, but it's not in there.
from classic.
I have found a solution. Adding customErrors Off like the below works. I have errors handled using IIS httpErrors still so it isn't showing the user any exception details. I tried setting customErrors to On and there is no exception info locally or remotely, DetailedLocal shows the original problem of exceptions locally and not remotely and Off shows exceptions for both.
I guess the solution is to make sure customErrors is set to Off!
<customErrors mode="Off"></customErrors>
from classic.
Thanks for the update. Looking into it further, it seems like generic error handling and customErrors
are often at odds. I think we should keep this ticket open to collect more data, but I am glad to hear you found a resolution.
from classic.
Hi @drjaydenm I have same issue I had to turn off custom errors in web.config:
<customErrors mode="Off"></customErrors>
But the IIS error pages are not working for me, could you plase share your web.config?
from classic.
I had to use httpErrors over custom errors for it to work correctly. The httpErrors work more at the IIS level than at the ASP level. You can read more about it here https://www.iis.net/configreference/system.webserver/httperrors
from classic.
I don't know if this will help, but in my case (MVC 5 app), the same app behvaes pretty differently depending on the settings .
- On my local machine with those settings :
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<customErrors mode="Off">
<error statusCode="400" redirect="Error/Error400" />
<error statusCode="401" redirect="Error/Error401" />
<error statusCode="403" redirect="Error/Error403" />
<error statusCode="404" redirect="Error/Error404" />
<error statusCode="500" redirect="Error/Error500" />
</customErrors>
</system.web>
I do get the full exception details
- and on a more "prod-ish" environment with those settings (note the
customErrors mode = "On"
) :
<system.web>
<compilation debug="false" targetFramework="4.6.1" />
<customErrors mode="On">
<error statusCode="400" redirect="Error/Error400" />
<error statusCode="401" redirect="Error/Error401" />
<error statusCode="403" redirect="Error/Error403" />
<error statusCode="404" redirect="Error/Error404" />
<error statusCode="500" redirect="Error/Error500" />
</customErrors>
I don't have the exception details:
In order to fix this, I had to remove the HandleErrorAttribute
that was applied globally.
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
//filters.Add(new HandleErrorAttribute{ View = "Error500", Order = 1 });
}
}
Without this handler, the app seems to behave the same way no matter the options.
from classic.
Related Issues (20)
- Calling cfg.LogAtLevel to set the LogEventLevel seems to disable HTTP request logging? HOT 8
- UserName enricher shows (anonymous) in ApplicationLifecycleModule with Microsoft.AspNet.WebApi.* >= 5.2.5 HOT 5
- Applicationlifecycle module question HOT 7
- Using the EnvironmentUserName if none? HOT 2
- HttpModule stops working when stressed. HOT 6
- Exception with null key in form data HOT 3
- EnableFormDataLogging not logging anything with WebApi HOT 2
- .netStandard v2 version ? HOT 1
- HttpRequestUrlEnricher gives "Request is not available in this context" exception HOT 6
- Special cases when using `FilterKeywords()` with `EnableFormDataLogging()` HOT 5
- ASP .NET Core enrichers? HOT 2
- Add Http Data To All Logging Events HOT 1
- How to troubleshoot the ApplicationLifecycleModule HttpModule is loading and configured properly? HOT 6
- WithUserName Only Working With HttpModule Logging But Doesnt Log During Web Service/API Logs HOT 8
- HttpModule isn't extensible? HOT 2
- SerilogWeb.Classic IIS classic mode incompatibility HOT 1
- Customize HttpRequestEventMessageTemplate HOT 6
- Log CorrelationId with SerilogWeb.Classic's log entries HOT 2
- IIS Web application hang up after multiple requests stuck on "Begin request" HOT 1
- Multiple log messages for single Request with error 404 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classic.