Hi All I have a question about using named loggers in the nlog.config file with WindsorContainer
I have an nlog.config that looks like this: <nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/ NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <variable name="logDirectory" value="${basedir}/logs"/> <targets> <target name="f1" xsi:type="File" fileName="${logDirectory}/ logfile.txt"/> <target name="f2" xsi:type="File" fileName="${logDirectory}/$ {shortdate}/dayfile.txt"/> </targets> <rules> <logger name="*" levels="Debug,Info,Warn,Error,Fatal" writeTo="f1"/ > <logger name="DailyLogger" levels="Debug,Info,Warn,Error,Fatal" writeTo="f2"/> </rules> </nlog> And I've configured the LoggingFacility facility as: <facility id="logging" type="Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging" loggingApi="nlog" configFile="nlog.config" / > Everything works fine. Any component that needs an ILogger (via property or constructor injection) - and is registered with the container - will get an ILogger. But how can I get a Logger for a named logger in the rules section of nlog.config - like DailyLogger shown above? NLog takes care of most of this by allowing you to set the name of the logger to the namespace and class that is calling the logger (I think) - so I'm assuming that I just match the logger rules I'm using with the calling classes (any class that logs something). But I was wondering if it is possible to call a named logger specifically. In NLogFactory - there is a Create method - that will allow a name to be passed - so that LogManager can create a specific logger (which is then wrapped and returned as an NLogLogger). But unless I'm using NLogFactory directly (i.e. without WindsorContainer) - I'm not exactly sure how to specific the name of a logger when NLog is registered as a facility in the container - since the only options in the facility are for the configuration file location. New to Castle, Windsor and NLog so I may be missing something obvious. Any suggestions, or advice on getting named loggers, or on a logging strategy in general.. greatly appreciated. Tony --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
