What logging library or approach would you recommend for this case:
- We want to be able to log both from managed and unmanaged code
- For the unmanaged code, the implementation should not cross back into managed code, because this could cause our unmanaged threads to get 'caught' during a garbage collection.
- Performance is a concern
NLog provides a "C" api, but implements it in terms of its managed implementation.
Many of the C logging libraries out there (rlog, glog) are reliant on macros + preprocessing and are not amenable to wrapping with .NET without extensive modification.
I guess I'm looking for something with a native/unmanaged logging core, but a decent .NET managed api as well. Does this exist? If this doesn't exist, what comes the closest?
Followup - Thanks for the responses mentioning log4net. I think Log4Net and NLog both perform ok in a pure managed application, -but-... The app I've been asked to build has unmanaged I/O on a background thread that absolutely cannot afford to be stopped by a garbage collection. If unmanaged c++ code has to call "up" into a managed logger, it stands a chance of being frozen for 200 or even 2000 milliseconds while the garbage collection occurs. That's why I'm looking for a library that is unmanaged at its core. - Dave