FallbackGroup drops log messages

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FallbackGroup drops log messages

AndreasK
I just wrote a simple app to test the FallbackGroup functionallity and I found that log messages is lost when the first target goes down. Here is the app and my configuration:

        private static Logger logger = LogManager.GetLogger("AKlogger");
        private static int i;
        public Form1() {
            InitializeComponent();
            i = 0;
        }        
        private void Form1_Load(object sender, EventArgs e) {
            logger.Info("Application start. {0}",i++);
        }
        private void button1_Click(object sender, EventArgs e) {
            logger.Info("Button pressed: {0}",i++);
        }

NLog.config:

<targets>
  <target xsi:type="FallbackGroup" returnToFirstOnSuccess="true" name="FallbackGrp">
      <target name="splunktcp" xsi:type="Network" newLine="true" address="tcp4://192.168.201.21:9999"/>
      <target name="logfile" xsi:type="File" fileName="c:/temp/nLogTestFile.log" />
  </target>
</targets>
<rules>
    <logger name="*" minlevel="Info" writeTo="FallbackGrp" />   
</rules>


The tcp4 target is a Splunk tcp input. If I shutdown Splunk and then press the button, the first push on the button never gets logged to the log file. The second push and all others is written to the log file just fine.
When I start up Splunk again logging is returned to Splunk without any dropped log messages.

Have I done something wrong or is this a bug?

Regards,
Andreas