Which library or registration approach would you recommend for this case:
- We want to be able to register both managed and unmanaged code
- For unmanaged code, the implementation should not go back to managed code, because this can cause our unmanaged threads to be “caught” during garbage collection.
- Performance is a problem.
NLog provides a "C" api, but implements it in terms of a managed implementation.
Many of the C logging libraries there ( rlog , glog ) depend on macros + preprocessing and are not susceptible to the .NET wrapper without extensive modification.
I guess I'm looking for something with a native / unmanaged logging kernel, but also worthy of the .NET api. Does it exist? If this does not exist, then what is closest?
Followup - Thanks for the answers mentioning log4net. I think that Log4Net and NLog both work fine in a clean managed application, but ... The application I was asked to build had unmanaged I / O in the background thread, which absolutely could not afford to stop garbage collection. If unmanaged C ++ code should call up to a managed logger, it has a chance to be frozen for 200 or even 2000 milliseconds while garbage collection occurs. That is why I am looking for a library that is unmanageable in nature. - Dave