title: Log4net XMLLayout produces too many elements
body: <p>I've just taken over a C# project that uses the log4net xmllayout for logging. </p>
  
  <p>The problem is that each event in the log has 4 data values: machinename, hostname, username and app which are always the same but are repeated for each event leading to unnecessarily large log files. </p>
  
  <p>How do I prevent these from being logged? </p>
  
  <p>Config file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;configuration&gt;
  
    &lt;!--log4net setting--&gt;
  
    &lt;configSections&gt;
  
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
  
    &lt;/configSections&gt;
  
    &lt;log4net&gt;
  
      &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
  
        &lt;file type="log4net.Util.PatternString" value="%env{LocalAppData}\\myApp\\myApp.log.xml" /&gt;
  
        &lt;appendToFile value="true" /&gt;
  
        &lt;rollingStyle value="Size" /&gt;
  
        &lt;maxSizeRollBackups value="1" /&gt;
  
        &lt;maximumFileSize value="3MB" /&gt;
  
        &lt;staticLogFileName value="true" /&gt;
  
        &lt;layout type="log4net.Layout.XmlLayoutSchemaLog4j"&gt;
  
        &lt;/layout&gt;
  
      &lt;/appender&gt;
  
      &lt;root&gt;
  
        &lt;level value="DEBUG" /&gt;
  
        &lt;appender-ref ref="RollingFileAppender" /&gt;
  
      &lt;/root&gt;
  
    &lt;/log4net&gt;
  
  
  
    &lt;system.serviceModel&gt;
  
      &lt;bindings&gt;
  
        &lt;basicHttpBinding&gt;
  
          &lt;binding name="BasicHttpBinding_myAppWCF" closeTimeout="00:01:00"
  
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
  
            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
  
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
  
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
  
            useDefaultWebProxy="true"&gt;
  
            &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
  
              maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
  
            &lt;security mode="None"&gt;
  
              &lt;transport clientCredentialType="None" proxyCredentialType="None"
  
                realm=""&gt;
  
                &lt;extendedProtectionPolicy policyEnforcement="Never" /&gt;
  
              &lt;/transport&gt;
  
              &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
  
            &lt;/security&gt;
  
          &lt;/binding&gt;
  
        &lt;/basicHttpBinding&gt;
  
      &lt;/bindings&gt;
  
      &lt;client&gt;
  
        &lt;endpoint address="http://localhost:12372/conserv" binding="basicHttpBinding"
  
          bindingConfiguration="BasicHttpBinding_myAppWCF" contract="myAppNOWServiceClient.myAppWCF"
  
          name="BasicHttpBinding_myAppWCF" /&gt;
  
      &lt;/client&gt;
  
    &lt;/system.serviceModel&gt;
  
    &lt;startup&gt;
  
      &lt;supportedRuntime version="v2.0.50727"/&gt;
  
    &lt;/startup&gt;
  
  &lt;/configuration&gt;
  </code></pre>