I have a WCF stand-alone service that uses log4net with all its configuration in my app.config file, and I am encrypting the config file on first run of the service. I currently have this set up to run as a console app but when I start it, straight after the encrypted config file is saved, the service prints out
log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [EncryptedData] to set object on [log4net.Repository.Hierarchy.Hierarchy]
which confuses me as there is an EncryptedData section in the log4net section of the newly-encrypted config file.
I'm encrypting the config file sections using:
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
my log4net config file section looks like this (before):
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" restartOnExternalChanges="false" />
</configSections>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
and after:
<log4net configProtectionProvider="DataProtectionConfigurationProvider">
<EncryptedData>
<CipherData>
<CipherValue>AQAAANCMnd8BFdERjHoAw <etc> </CipherValue>
</CipherData>
</EncryptedData>
</log4net>
Log4net still works with the encrypted configuration (edit: that is in debug; when run in release as a service (but permissions opened up) it fails to log anything)
So, can anyone tell me what this error is and how to fix up my code to stop it being thrown.