Log4Net and Orleans

I was wondering what is the best way to use log4net in Microsoft Orleans? Where should it be initialized?

+5
source share
2 answers

I think the best place to initialize for static silo variables is in Silo Bootstrap .

Please note that Orleans is configured for the logger, and you can get it in grains by calling this.GetLogger() .

<edit> You can define a logger that inherits from ILogConsumer and add it to the collection of log receivers by calling Orleans.Runtime.TraceLogger.LogConsumers.Add() <./ Edit>

<edit 2015-07-16> :: This reappeared on the Orleans Gitter channel , where the following advice was offered from the main team member:

we publish in .NET Trace, and you can add new listeners to it. this is really the best way to do this without even touching Orleans.Runtime.TraceLogger.LogConsumers. just work with .NET TRace, with the usual tools and configuration. not related to Orleans. we just publish in Trace.

Added a new note to another Stackoverflow post, "Best Logging Practices," in which Sly Gryphon through the trace infrastructure is pretty comprehensive.

+8
source

Almost all Orleans patterns use a static class to create objects. Log4net uses the same structure to create ILog classes. There is no reason to use or do it otherwise than the standard recommended method.

+1
source

Source: https://habr.com/ru/post/1214092/


All Articles