NLog.Web icon indicating copy to clipboard operation
NLog.Web copied to clipboard

Port AspNetBufferingWrapper to ASP.NET Core

Open 304NotModified opened this issue 5 years ago • 12 comments

From https://github.com/NLog/NLog/issues/2806

Port to middleware.

Current docs: https://github.com/nlog/nlog/wiki/AspNetBufferingWrapper-target

304NotModified avatar Jul 17 '18 20:07 304NotModified

Any progress to this?

Baklap4 avatar Nov 01 '18 09:11 Baklap4

Nope. This isn't started. Do you need it?

304NotModified avatar Nov 01 '18 16:11 304NotModified

We'd love to use this in our projects since we're creating lots of log items and don't want to create a new connection everytime we write our log to Elastic Search. (We currently use the elastic search target)

Baklap4 avatar Nov 06 '18 09:11 Baklap4

Feel free to create a PR 👍

304NotModified avatar Nov 06 '18 13:11 304NotModified

https://docs.microsoft.com/en-us/aspnet/core/migration/http-modules?view=aspnetcore-2.2

304NotModified avatar Sep 18 '19 00:09 304NotModified

Please use the thumbs up in the start post. Thanks!

304NotModified avatar Feb 26 '21 21:02 304NotModified

Sending a +1 message (and notification) every minute won't help implementing this...

304NotModified avatar Feb 26 '21 21:02 304NotModified

Guess this should be followed for implementing this: https://docs.microsoft.com/en-us/aspnet/core/migration/http-modules?view=aspnetcore-5.0

Source code of the current wrapper: https://github.com/NLog/NLog.Web/blob/master/src/NLog.Web/Targets/Wrappers/AspNetBufferingTargetWrapper.cs

304NotModified avatar Feb 26 '21 21:02 304NotModified

@jdpapiero @jenunez @david-pierola-incontact @muchachopolo @ferd-altamirano @marcos-bustos-nice @antonio-schlappa-incontact @milton-ballon-incontact @Baklap4 @justhoma

If I create middleware for this, so this will work in ASP.NET Core, could one of you please test it? I will create a pre-release package then.

304NotModified avatar Feb 27 '21 16:02 304NotModified

Sure. I will. @304NotModified

miltonballon avatar Feb 27 '21 23:02 miltonballon

I submitted a PR for review for this

bakgerman avatar Jul 08 '22 18:07 bakgerman

Pre-Release from #816 is available here:

https://ci.appveyor.com/project/nlog/nlog-web/builds/44420816/artifacts

If people want to help test/verify/review the direction. The following middleware must be enabled:

 app.UseMiddleware<NLog.Web.NLogBufferingTargetWrapperMiddleware>();

@jdpapiero @jenunez @david-pierola-incontact @muchachopolo @ferd-altamirano @marcos-bustos-nice @antonio-schlappa-incontact @milton-ballon-incontact @Baklap4 @justhoma

snakefoot avatar Aug 04 '22 05:08 snakefoot

Thank you snakefoot for the pull request to close this issue.

bakgerman avatar Nov 25 '22 01:11 bakgerman

https://www.nuget.org/packages/NLog.Web.AspNetCore v5.2.1 has been released with support for AspNetBufferingWrapper on ASP.NET Core via NLogBufferingTargetWrapperMiddleware.

  • https://github.com/NLog/NLog/wiki/AspNetBufferingWrapper-target

Thanks to @bakgerman that made it happen.

snakefoot avatar Dec 30 '22 11:12 snakefoot