Skip to content

Instantly share code, notes, and snippets.

@haasey
haasey / gist:5878737
Last active December 19, 2015 01:49
ELMAH configuration in web.config. Cannot be easily external because it needs multiple sections in the web.config.Running put everything in I needed except the attribute runAllManagedModulesForAllRequests="true" on the <system.webServer> <modules runAllManagedModulesForAllRequests="true"> section
<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<system.web>
<httpModules>
@haasey
haasey / gist:5877090
Last active December 19, 2015 01:39
Log4Net.config separate file for just Log4Net configuration
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="..\Logs\CurrentLog.txt" />
<appendToFile value="true" />
@haasey
haasey / log4netConfig
Last active December 19, 2015 00:49
This is the Configuration for you web.config or application.config file that links to another configuration file holding only your log4Net configuration. We don't want to over clutter web.config. Nicer for file compares etc.
<configsections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configsections>
<log4net configsource="log4Net.config" />