How to change Container logging to the Windows Event Log

By default, Containers log to text files in their current working directory. Containers can be configured to log to the Windows Event Log.

Step-by-step guide

  1. Open Cloudhouse.Container.Deployment.exe.config from the deployment folder
  2. remove the <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> section
  3. add the following section where the above was:
  4. <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
            <layout type="log4net.Layout.PatternLayout">
                    <logName value="Application"/>
                    <applicationName value="Cloudhouse AppName"/>
                    <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
    </appender>
  5. replace <appender-ref ref="RollingFileAppender"/> with  <appender-ref ref="EventLogAppender"/>


The final config file should look like this.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <configSections>
  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
 </configSections>
 <startup> 
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
 </startup>
<log4net>
 <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
   <layout type="log4net.Layout.PatternLayout">
     <logName value="Application"/>
     <applicationName value="Cloudhouse AppName"/>
     <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
   </layout>
 </appender>

 <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> 
   <layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="%date %-5level %logger - %message%newline"/>
   </layout>
 </appender>
 <root>
  <level value="INFO"/>
  <appender-ref ref="ConsoleAppender"/>
  <appender-ref ref="EventLogAppender"/>
  </root>
 </log4net>
</configuration>

Applies To

Cloudhouse Containers

Was this article helpful?

Can't find what you're looking for?

Contact Support