Search code examples
c#nservicebus

How to setup Performance Counters with NServiceBus in all the projects as per requirement


I am trying to run the downloadable .Net(Version 4.6.1) projects provided by NServiceBus at the following link

https://docs.particular.net/samples/step-by-step/

When I try to run the application, I am getting the below error...

NServiceBus.PerformanceCounterHelper NServiceBus performance counter for '# of msgs pulled from the input queue /sec' is not set up correctly. To rectify this problem, consult the NServiceBus performance counters documentation.

How to run the code without getting INFO messages from each of the 4 projects in it?


Solution

  • To fix the issue with Performance Counters, please have a look at the documentation to learn how to install the counters and let me know if that resolved your issue.

    To change the logging level, follow the instructions in the documentation. For NServiceBus version 6 you simply need to add the following code at the start of the main method in Client, Server and Subscriber projects:

    var defaultFactory = LogManager.Use<DefaultFactory>();
    defaultFactory.Level(LogLevel.Error);