<p>I am using Log4Net with the AdoNetAppender to log messages from a simple systray application into a SQL Server 2005 database.</p>

<p>I want to log the machine name along with the log message because this application will be running on multiple machines and I need to know on which one the message originated.</p>

<p>But, I cannot find a way to expose this information via the log4net.Layout.PatternLayout that I am using with the appender.</p>

<p>Is there a way to log the machine name via log4net in this manner?</p>

you can create a parameter similar to the following:
```
```
<parameter>
  <parameterName value="@machine" />
  <dbType value="String" />
  <size value="255" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%X{machine}" />
  </layout>
</parameter>
```
```
Then add this line before writing to the log:
```
MDC.Set("machine", Environment.MachineName);
```