Skip to content
Xharze edited this page Sep 22, 2012 · 1 revision

Writes log message to the specified message queue handled by MSMQ.

Supported in .NET, Compact Framework and Mono. ##Configuration Syntax

<targets>
  <target xsi:type="MSMQ"
          name="String"
          useXmlEncoding="Boolean"
          encoding="Encoding"
          layout="Layout"
          recoverable="Boolean"
          createQueueIfNotExists="Boolean"
          label="Layout"
          queue="Layout" />
</targets>

Read more about using the Configuration File. ##Parameters ###General Options name - Name of the target. ###Layout Options useXmlEncoding - Indicates whether to use the XML format when serializing message. Boolean Default: False

encoding - Encoding to be used when writing text to the queue. Encoding

layout - Layout used to format log messages. Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message} ###Queue Options recoverable - Indicates whether to use recoverable messages (with guaranteed delivery). Boolean Default: False

createQueueIfNotExists - Indicates whether to create the queue if it doesn't exists. Boolean Default: False

label - Label to associate with each message. Layout Default: NLog
By default no label is associated.

queue - Name of the queue to write to. Layout Required.
To write to a private queue on a local machine use .\private$\QueueName. For other available queue names, consult MSMQ documentation.

##Notes The MSMQ target requires that:

  • NLog.extended.dll be along side the NLog.dll at runtime.
  • The machine doing the logging have MSMQ installed with the Active Directory Domain Services Integration option. If the option is not installed, the target will throw an exception.
  • The queue being written to is NOT transactional.

Clone this wiki locally