.net - Dynamically setting a log4net property using common.logging -


Does anyone know that it is similar in general. Logging (for Net) to set the property for the log4net factory adapter? I have had great success using the log-in:

  & lt; Appender name = "file exceptions" type = "log4net.Appender.RollingFileAppender" & gt; & Lt; File type = "log4net.Util.PatternString" value = "logs \ log_% properties {brokerID} .txt" /> & Lt; AppendToFile value = "wrong" /> & Lt; Rolling style value = "size" /> & Lt; MaxSizeRollBackups value = "- 1" /> & Lt; Max file size value = "50 GB" /> & Lt; Layout type = "log4net.Layout.PatternLayout" & gt; & Lt; Conversion pattern value = "% date% -5 level% logger -% message% newline" / & gt; & Lt; / Layout & gt; & Lt; / Appender & gt;  

and the installation of assets like: log4net.GlobalContext.Properties ["BrokerID"] = 10

The file looks like this: Log_ (null) .txt when using common.logging to wade log4net on fly.net

Let me look at the previous question that it might be helpful, probably not.

To summarize:

  1. General. Logging (Net) says that support for that "context" has been planned "next" Release

  2. This is not clear when the next release (current release 2.0) is scheduled. The website "June" says the current release (2.0) was April 2009. The website was last updated in May 2009 (perhaps announcing 2.0)? What does "June" mean? June 2009? June 2010? Both came and went.

  3. Given that "context" support is not yet available in general. Logging, take a look at the "reference" implementation in the Castle project (log4net)). It will not be difficult for the port to implement. Logging. One risk is that context implementation that usually comes from mango. Logging can not be similar to the Castle implementation.

  4. Castle "context" support applies to ILOG / Illogger interfaces. Therefore, rather than setting the context in this way:

Access references directly via log4net:

  log4net.GlobalContext.Properties ["BrokerID"] = 10;  

Access references through logging abstraction:

  iLog logger = common.logging.log manager. GateCurrent Class Logger (); Logger Global Contact Properties ["brokeride"] = 10;  

When you have a logger, it feels great to have a perspective of setting the context. It may not be so good that you want to set a context without getting a logger. If Common.Logging.LogManager knows that the intangible is "active" (and this should be because the LockManager.Adapter is Lockout / gettable via property). Therefore, perhaps the "context" may also be available from the ILog interface as well as the LogManager.Adapter interface.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -