damianh / LimitsMiddleware

OWIN middleware to apply limits to an OWIN pipeline.
MIT License
0 stars 0 forks source link

Documentation: how to use loggers #26

Closed rdstevens closed 8 years ago

rdstevens commented 8 years ago

Hi,

I'm trying to use NLog with LimitsMiddleware, and so far I'm stuck. Are there any docs available? I've had a look at the demo code, and I'm now working through the codebase...

Cheers, Rob

StefanOssendorf commented 8 years ago

It should be sufficient to reference the logging framework (in your case NLog) in your lib/application and enable it. In other words: It should just works :D (to handle loggin LibLog is used) LimitsMiddleware is primarliy using Debug and Information-Logs. Maybe you are logging only errors?

HTH, if not. damian is your man ;D

rdstevens commented 8 years ago

Ah, yes - the bit I was missing was the use of the logger name and the overload in the limit function.

For reference, this is what worked

public void Configuration(IAppBuilder appBuilder)
{
    HttpConfiguration config = new HttpConfiguration();

    Logger logger = LogManager.GetCurrentClassLogger();
    appBuilder.MaxConcurrentRequests(20,` logger.Name).UseWebApi(config);
}