I have a custom appender in another dll and I want to set a value "Element.MachineName" inside the log4net.config file.
It works with a static value like : <appName ="SomeName" />
but how can I set this value with Element.MachineName ?
<appender name="SomeAppender" type="ConsoleApplication1.SomeAppender">
<appName value="someName"/>
<host value="how to set the host to this variable?" />
<layout type="log4net.Layout.LayoutPattern">
<conversionPattern value="[%date{MM/dd/yyyy hh:mm:ss tt}] %property{HostName} [%-5level] [%class]-[%method] - [%message] %newline" />
</layout>
</appender>
You could use the global context for this purpose. See this log4net page, it explains how you can set the properties. In your settings you could use something like this: