nHapi icon indicating copy to clipboard operation
nHapi copied to clipboard

Support inserting custom logging framework

Open fredrikcarlbom opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. We are considering using nHapi in our product but since it writes its logs using a custom log framework that is a drawback.

Describe the solution you'd like Supporting Microsoft.Extensions.Logging.Abstractions.ILoggerFactory would be ideal the ideal solution. This would also require implementing a default LoggerFactory that behaves like the current logging does

Describe alternatives you've considered Using the current framework with trace listeners and output using the same format as our application.

Additional context This would require dropping NET 3.5 support since Standard 2.0/Framework 4.6.1 is required.

fredrikcarlbom avatar Feb 21 '22 14:02 fredrikcarlbom

@fredrikcarlbom Sounds like an excellent idea to me, though as it stands at the moment there isn't an army of people to pick these feature requests up, interested in supporting such a feature request?

In regards to your idea, I like it, I don't think nhapi.base should take a direct dependency on Microsoft.Extensions.Logging.Abstractions it should probably have its own ILogger interface which would expose an api very similar if not identical to microsofts ILogger interface, it should have a simple base implementation which could even be a null logger similar to NullLogger.

There could then be a separate nhapi.extensions.logging package which would be a simple adaptor for microsoft.extensions.logging.

What do you think?

@duaneedwards @AMCN41R what do you think?

milkshakeuk avatar Feb 21 '22 19:02 milkshakeuk

@milkshakeuk Your solution sounds reasonable. I can't promise that I can help out with this or not, we have not made any final decision to go with nHapi.

fredrikcarlbom avatar Feb 23 '22 21:02 fredrikcarlbom

@milkshakeuk Your solution sounds reasonable. I can't promise that I can help out with this or not, we have not made any final decision to go with nHapi.

@fredrikcarlbom did you ever make a decision?

milkshakeuk avatar Apr 24 '22 14:04 milkshakeuk

https://xfischer.github.io/logging-dotnet-core/

milkshakeuk avatar Oct 31 '22 20:10 milkshakeuk