Das problem hat sich durch ein redesign gelöst. verwende nun ein eigenständiges config file für die log4net konfiguration und das funktioniert problemlos
Beiträge von Alter Schwede
-
-
Hallo,
Ich hab ein Ähnliches Problem und finde keine Lösung. Ich bekomme zur Laufzeit folgenden Fehler:
Error: log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
Mein Assembly file:
Mein app.config:HTML
Alles anzeigen<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="applicationSettings"> .... </sectionGroup> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> </configSections> <log4net> <appender name="FileAppender" type="log4net.Appender.FileAppender"> <file value="C:\logfile.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="FileAppender" /> </root> </log4net> <applicationSettings> ... </applicationSettings> </configuration>
mein c# code:Code[size=10][COLOR=#0000ff][size=10][COLOR=#0000ff]public [/COLOR][/SIZE][size=10][COLOR=#0000ff]class [/COLOR][/SIZE][size=10][COLOR=#2b91af]InputChannelManager[/COLOR][/SIZE] [size=10]{[/SIZE] [size=10][COLOR=#0000ff]private [/COLOR][/SIZE][size=10][COLOR=#0000ff]static [/COLOR][/SIZE][size=10][COLOR=#0000ff]readonly [/COLOR][/SIZE][size=10][COLOR=#2b91af]ILog[/COLOR][/SIZE][size=10] log = [/SIZE][size=10][COLOR=#2b91af]LogManager[/COLOR][/SIZE][size=10].GetLogger([/SIZE][size=10][COLOR=#0000ff]typeof[/COLOR][/SIZE][size=10]([/SIZE][size=10][COLOR=#2b91af]InputChannelManager[/COLOR][/SIZE][size=10]));[/SIZE] [size=10][COLOR=#0000ff]public[/COLOR][/SIZE][size=10] InputChannelManager()[/SIZE] [size=10]{[/SIZE] [size=10]log4net.Config.[/SIZE][size=10][COLOR=#2b91af]XmlConfigurator[/COLOR][/SIZE][size=10].Configure();[/SIZE] [size=10]log.Debug ([/SIZE][size=10][COLOR=#a31515]"This is a logtest for InputManager"[/COLOR][/SIZE][size=10]);[/SIZE] [size=10][COLOR=#0000ff]this[/COLOR][/SIZE][size=10].InitialzeFileWatchers();[/SIZE] [size=10]}[/SIZE] [/COLOR][/SIZE]
Ich hab schon diverseste varianten ausprobiert in der app.config und im assembly alle mit dem gleichen resultat :o(