How to change Container logging to the Windows Event Log

Save to PDF

Applies to: Cloudhouse Compatibility Containers

15/05/2019 Cliff Hobbs   ID: 266888

Overview

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

Step-by-step process

To configure a Container to log to the Event Log:

  1. Open Cloudhouse.Container.Deployment.exe.config from the deployment folder.
  2. Use the sample replacement code below.
  3. Change Cloudhouse AppName to the desired application name.
<?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" >
     <logName value="Application"/>
     <applicationName value="Cloudhouse AppName"/>
     <layout type="log4net.Layout.PatternLayout">
       <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>


Note

Text in red italics indicates changes to the default configuration.

Source:
Was this article helpful?

Table of Contents

    Can't find what you're looking for?

    Contact Support