I am trying to send a message to MSMQ queue using Log4Net.I spent lot of time to understand the functionality from the net. But I couldn't find much help. The following is my source code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;
namespace MQTest
{
class Program
{
private static readonly ILog ilogger = LogManager.GetLogger("");
static void Main(string[] args)
{
ilogger.Debug("This should go to the queue");
ilogger.Fatal("This should go to the queue");
}
}
}
app.config
<log4net>
<appender name="MsmqAppender" type="MQTest.Appender.MsmqAppender, MQTest">
<queueName value="private$\test_queue"/>
<labelLayout value="LOG [%level] %date"/>
<layout type="log4net.Layout.XmlLayoutSchemaLog4j"/>
</appender>
<root>
<level value="ALL"/>
<appender-ref ref="MsmqAppender" />
</root>
</log4net>
When I debug the code, I have noticed that IsDebugEnabled = false, IsFatalEnabled =false etc. I don't know how to populate the above flags, while using MsmqAppender.
Thanks for your help