Skip to content
Pete Smith edited this page Jun 25, 2014 · 9 revisions

AzureNetQ does not yet provide explicit logging capabilities, although its behavior is very simple when compared to EasyNetQ/RabbitMQ so this is less relevant.

AzureNetQ will provide a logger interface [IAzureNetQLogger]:

public interface IAzureNetQLogger
{
   void DebugWrite(string format, params object[] args);
   void InfoWrite(string format, params object[] args);
   void ErrorWrite(string format, params object[] args);
   void ErrorWrite(Exception exception);
}

By default AzureNetQ logs to the console, which is probably not what you want in a production system. The debug level logging is very verbose and will not make much sense to someone without an intimate knowledge of AMQP and EasyNetQ. You should provide your own implementation of IAzureNetQLogger that logs info and error messages to your application's log.

The AzureBusFactory.CreateBus method provides overloads that allow you to replace any of the AzureNetQ components. See Replacing AzureNetQ Components. When implemented, you will be able to use this to register your custom logger with the bus. For example:

var settings = new AzureNetQSettings {
    Logger = () => new MyLogger() // implements IAzureNetQLogger
};
var bus = AzureBusFactory.CreateBus(“my connection string”, settings);
Clone this wiki locally