-
-
Notifications
You must be signed in to change notification settings - Fork 142
ExceptionlessTarget - ProcessQueueAsync for ExceptionlessClient on Flush #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@niemyjski I can see that #241 changed the default LogLevel from Trace to Warn. Would it make sense that NLog LoggingRule controlled what LogLevel should produce output? (See that Serilog-Sink has similar issues with the new default value) Example of using <?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">
<targets async="true">
<target type="Exceptionless, Exceptionless.NLog" name="exceptionless" apiKey="API_KEY_HERE">
<field name="host" layout="${machinename}" />
<field name="process" layout="${processname}" />
<field name="user" layout="${environment-user}" />
</target>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="exceptionless" />
</rules>
</nlog> Could also consider adding a new |
@@ -62,5 +71,9 @@ public class ExceptionlessTarget : TargetWithLayout { | |||
|
|||
builder.Submit(); | |||
} | |||
|
|||
protected override void FlushAsync(AsyncContinuation asyncContinuation) { | |||
_client.ProcessQueueAsync().ContinueWith(t => asyncContinuation(t.Exception)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is FlushAsync (https://nlog-project.org/documentation/v4.4.0/html/M_NLog_Targets_Target_FlushAsync.htm) called during shutdown or periodically during buffering? If it's while it's buffering, then we probably should remove this as that's already taken care of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NLog only calls Flush on process-exit, or if the user explict calls NLog.LogManager.Flush()
or NLog.LogManager.Shutdown()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks great and I'll merge it, left one question.
@snakefoot yeah, I was considering that the logging targets could just set the default min log level on the client (which is only used until server settings were retrieved and last call to that method wins. |
Sounds like a sensible way of handling minimum-loglevel, that you perform a "handshake" on first logevent, instead of always using LogLevel.Warn as default. Much more user-friendly. |
Better user-experience when using NLog, and NLog InternalLogger is the recommended place to look when troubleshooting.