exceptionless / Exceptionless.Net

Exceptionless clients for the .NET platform
https://exceptionless.com
Other
557 stars 142 forks source link

ExceptionlessTarget - ProcessQueueAsync for ExceptionlessClient on Flush #301

Closed snakefoot closed 1 year ago

snakefoot commented 1 year ago

Better user-experience when using NLog, and NLog InternalLogger is the recommended place to look when troubleshooting.

snakefoot commented 1 year ago

@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 minLevel="Info" with 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">
  <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 GetMinLevel where one could specify the default value for new sources. Where NLog could specify Trace-LogLevel (instead the new default Warn-LogLevel)

niemyjski commented 1 year ago

@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.

snakefoot commented 1 year ago

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.