Shipping logs to from NLog gets fail

68 Points
24 Posts

I have .netcore rest api application with NLog logging mechanism. And working fine to file, email.
But now, I'm trying to ship to as mentioned in:

NLog config:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns=""

  <!-- Load the ASP.NET Core plugin -->
    <add assembly="NLog.Web.AspNetCore"/>
    <add assembly="Logzio.DotNet.NLog"/>

  <!-- the targets to write to -->
    <!-- write logs to file -->
    <target xsi:type="File" name="allfile"
            layout="${longdate}|${event-properties:item=EventId.Id}|${logger}|${uppercase:${level}}|${message} ${exception}" />

    <target name="logzio" type="Logzio"
            <contextproperty name="host" layout="${machinename}" />
            <contextproperty name="threadid" layout="${threadid}" />

  <!-- rules to map from logger name to target -->
    <!--All logs, including from Microsoft-->
    <logger name="*" minlevel="Trace" writeTo="allfile" />

    <logger name="*" minlevel="Info" writeTo="logzio" />

C# controller have this line :

private static Logger logger = LogManager.GetCurrentClassLogger();

and then I try to ship my logs using something like :

logger.Fatal("Something bad happens, ship to");

Nothing is appearing on web portal, no logs are shipped there.

Also, checking internal-nlog.txt no error is logging

Views: 205
Total Answered: 2
Total Marked As Answer: 1
Posted On: 06-May-2020 00:52

Share:   fb twitter linkedin
34 Points
7 Posts

NLog by default eats all exceptions, so problems with logging will not cause the application to break. So, if you want to see exception then you can do following configuration:

  • Add throwConfigExceptions="true", will make NLog complain when something is wrong with the configuration.
  • Set internalLogLevel="Trace"

I.e. make following change in config:

<nlog xmlns=""

Now, even you can see errors in internal-nlog.txt file too.

Posted On: 06-May-2020 22:28
68 Points
24 Posts

Thanks. Now, found the exact error and after fixing it logs are appearing on

Posted On: 07-May-2020 00:27
 Log In to Chat