Has anyone used MSMQ with NLog?

2 messages Options
Embed this post
Permalink
AjayN

Has anyone used MSMQ with NLog?

Reply Threaded More More options
Print post
Permalink
I have been trying to use MSMQ as target without any success.  I asked twice but nobody replied. Is nobody using MSMQ to drop log messages? I am stuck and really need help else I need to look at other logging mechanism/MS Application Block?

Here is my previous message extract - Thanks for your help again. -

Hi, I am unable to write to MSMQ target. Any pointer how to debug this issue. I am using .Net 3.5 framework. MSMQ is installed on remote server which is Windows 2003 server. I am putting queue attribute in config file as queue="FormatName:DIRECT=OS:newton\PRIVATE$\LoggingQueue" I am able to write a message to this queue without NLog, using simple windows forms application from same machine (this was just to check if MQ is accessible from this machine) Any pointers will be highly appreciated. Thanks & Regards, Ajay
IgalSe

Re: Has anyone used MSMQ with NLog?

Reply Threaded More More options
Print post
Permalink
Hi.
The current implementation of NLog doesn't work with remote queue. But it is easy to fix.
Another problem is that the queue is closed after every send which make it quit slow.

You can create your own msmq target by copying the source of msmq.cs and delete this snippet:

if (!MessageQueue.Exists(queue))
            {
                if (CreateQueueIfNotExists)
                    MessageQueue.Create(queue);
                else
                    return;
            }

You can also change some code ( mostly in the same method ) to prevent the queue closing.

There are older threads in this forum about those problems. Search for them.

Hope this helps.