apiVersion: v1
kind: ConfigMap
metadata:
  name: log4net-config
  namespace: <namespace>
data:
  Log4Net.config: |
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <log4net threshold="ALL">
        <root>
          <level value="ALL" />
           <!-- <appender-ref ref="ConsoleAppender" /> -->
          <appender-ref ref="FILE_DEBUG_APPENDER" />
          <appender-ref ref="FILE_ERROR_APPENDER" />
        </root>
        <!-- === File Appender for NON-ERROR messages file === -->
        <appender name="FILE_DEBUG_APPENDER" type="log4net.Appender.RollingFileAppender" class="ch.qos.logback.classic.AsyncAppender">
          <file type="log4net.Util.PatternString" value="%property{AppDataPath}/logs/%property{loggername}/debug-info-%env{HOSTNAME}.txt" />
          <filter type="log4net.Filter.LevelMatchFilter">
            <levelToMatch value="INFO" />
          </filter>
          <filter type="log4net.Filter.DenyAllFilter" />
          <additivity value="true" />
          <appendToFile value="true" />
          <maxSizeRollBackups value="1" />
          <maximumFileSize value="300KB" />
          <rollingStyle value="Size" />
          <staticLogFileName value="true" />
          <layout type="log4net.Layout.PatternLayout">
            <header type="log4net.Util.PatternString" value="#Software: %property{loggername} %newline#Date: %date %newline#Fields: date thread namespace methodname message %newline" />
            <conversionPattern value="%date	[%thread]	%message%newline" />
          </layout>
        </appender>
        <!-- === File Appender for ERROR messages file === -->
        <appender name="FILE_ERROR_APPENDER" type="log4net.Appender.RollingFileAppender" class="ch.qos.logback.classic.AsyncAppender">
          <file type="log4net.Util.PatternString" value="%property{AppDataPath}/logs/%property{loggername}/errors-%env{HOSTNAME}.txt" />
          <filter type="log4net.Filter.LevelMatchFilter">
            <levelToMatch value="ERROR" />
          </filter>
          <filter type="log4net.Filter.DenyAllFilter" />
          <additivity value="true" />
          <appendToFile value="true" />
          <maxSizeRollBackups value="10" />
          <maximumFileSize value="100KB" />
          <rollingStyle value="Size" />
          <staticLogFileName value="true" />
          <layout type="log4net.Layout.PatternLayout">
            <header type="log4net.Util.PatternString" value="#Software: %property{loggername} %newline#Date: %date %newline#Fields: date thread namespace methodname message %newline" />
            <conversionPattern value="%date	[%thread]	%-5level	%message%newline" />
          </layout>
        </appender>
        <!-- === Console Appender to use in BufferingForwardingAppender === -->
        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern type="log4net.Util.PatternString" value="%newline%%-5level  %property{loggername}  %env{HOSTNAME}  %%date	[%%thread]	%%message%newline" />
          </layout>
        </appender>  
      </log4net>
    </configuration>
