novotnyllc / MetroLog

A lightweight logging system designed specifically for Windows Store and Windows Phone 8 apps.
MIT License
146 stars 83 forks source link

DefaultLogManager duplicating log messages #87

Open dhearn opened 8 years ago

dhearn commented 8 years ago

The following Console application (.NET Framework 4.6.1) using latest NuGet package of MetroLog (1.0.1) duplicates explicit log messages:

    class Program
    {
        static void Main(string[] args)
        {
            ILogger log = LogManagerFactory.DefaultLogManager.GetLogger<Program>();
            log.Debug("Hello World");
        }
    }

This produces the following output:

1|2016-06-17T10:36:53.8269718+00:00|TRACE|8|Created Logger 'Program'
2|2016-06-17T10:36:53.8461676+00:00|DEBUG|8|Program|Hello World
2|2016-06-17T10:36:53.8461676+00:00|DEBUG|8|Program|Hello World

The automated "Created Logger" message is only logged once, but all explicit calls to log.Debug() etc are duplicated.

It seems to be related to when MetroLog is used outside of a UWP application. For example, a PCL which uses MetroLog and is consumed within a Console or WPF application on full Windows appears to exhibit this behaviour, however when the same PCL is consumed by a UWP app (e.g. on a Raspberry Pi)., it just logs each message once.