Transition to semantic logging with Castle ILogger and log4net

What's the best way to start using the new .NET 4.5 EventSource class for logging for an application that currently uses the Castle Logging Facility in conjunction with log4net.

At first, I thought it was possible to extend Castle ILogger's interface to support richer semantic-style logging that facilitates the EventSource ( Problem raised ), but now I'm not sure if they can really work together well.

I note that the semantic logging application block provides one implementation of using EventSource, but of course does not use ILogger.

+3
source share
1 answer

If you want to move to semantic logging in general, and not just to SLAB implementation, it may be easier for you to switch to Serilog , (Disclaimer - I started the project, although it has now worked well).

Serilog implements the same semantic logging concepts as EventSourcefriends, but uses the classic ILogger API that you get from Castle.

log.Information("The cart contains {CartSize} items", cart.Count);

CartSize , EventSource. ( {0} - , !)

API- , ILogger , EventSource s. , , .

+2

All Articles