Sentry.NLog not logging to Sentry
See original GitHub issuePlease mark the type framework used:
- ASP.NET MVC
- ASP.NET Web API (OWIN)
- ASP.NET Core
- WPF
- WinForms
- Xamarin
- Other: .NET 4.6.2 console app
Please mark the type of the runtime used:
- .NET Framework
- Mono
- .NET Core
- Version: 4.6.2
Please mark the NuGet packages used:
- Sentry
- Sentry.Serilog
- Sentry.NLog
- Sentry.Log4Net
- Sentry.Extensions.Logging
- Sentry.AspNetCore
- Version: 3.0.5
Hi there! 👋
Trying to get Sentry wired up via NLog, and not having much luck.
NLog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true"
internalLogLevel="Debug"
internalLogFile="c:\temp\nlog-internal.txt"
internalLogToConsole="true"
throwConfigExceptions="true">
<extensions>
<add assembly="Sentry.NLog" />
</extensions>
<targets>
<target xsi:type="Sentry"
name="sentry"
dsn="https://secret"
environment="test"
includeEventProperties="True"
layout="${message}"
breadcrumbLayout="${message}"
minimumBreadcrumbLevel="Debug"
ignoreEventsWithNoException="False"
includeEventDataOnBreadcrumbs="False"
includeEventPropertiesAsTags="True"
minimumEventLevel="Error" />
</targets>
<rules>
<logger name="*" minlevel="Error" writeTo="sentry" />
</rules>
</nlog>
Things I’ve checked:
- DSN. Copied and pasted from the Sentry portal, so i know it’s correct
- No filters on ‘environments’ in Sentry.
- Nlog log file shows no errors. In fact in shows Sentry being wired up.
- Added other targets to NLog (e.g console, file, etc), they work fine.
Any ideas?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Sentry.NLog not logging to Sentry
Nlog log file shows no errors. In fact in shows Sentry being wired up. Added other targets to NLog (e.g console, file, etc),...
Read more >Sentry.NLog Logs to NLog but Not to Sentry - SDKs
I am using the latest Sentry/NLog packages (as shown below) but for some reason, my errors are begin logged to NLog but not...
Read more >Troubleshooting for NLog
The following message may appear in your build output: The Sentry CLI is not fully configured with authentication, organization, and project. The message ......
Read more >Sentry.Samples.NLog does not work ...
LogInfo, Errors and etc should all be written to the console as it's one of the target. ... then nlog will work correctly...
Read more >Sentry.NLog 3.35.0
Official NLog integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bruno-garcia my bad. I think the problem was i wasn’t waiting long enough for it to ‘flush’. I was logging, then killing my app.
I let it run for a while, and it eventually came through. I guess i expected all NLog events to ‘flush’ at the same time. In this case, it was flushing to output 1 immediately, but Sentinel a few seconds later.
All good, will close issue. Sorry and thanks 😊
You can call SentrySdk.Close() at the end of the app execution to flush things out.
Ideally NLog Flush would pipe to sentry flush if that not the case yet