c# - Section types in Config files -
i'm using log4net first time, , can't figure out how add appropriate config settings. documentation pretty consistent adding <log4net>
section app.config file, compile correctly, don't need outline configsections
?
i have following right now:
<configuration> <configsections> <section name="system.servicemodel"/> <section name="appsettings" type="system.configuration.configurationmanager"/> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net" /> <section name="startup" /> </configsections> <system.servicemodel> ... </system.servicemodel> <appsettings> ... </appsettings> <log4net> ... </log4net> <startup><supportedruntime version="v4.0" sku=".netframework,version=v4.0"/></startup> </configuration>
but i'm receiving following errors:
xml document must contain root level element
the required attribute 'type' missing
(fromsystem.servicemodel
,startup
)could not find schema information element *
(*=everything in log4net)
i've read couple posts on section groups, , i've considered setting appsettings
, log4net
in separate config file. little on head.
should using separate config files?
if should putting in 1 config file, how know type section is? (i'm guessing on appsettings
type based on assembly use settings--and got type log4net
many posts including it.)
remove duplicate declaration in configsections "appsettings", "system.servicemodel", "startup"
.
declared in file machine.config installed framework in appropriate subfolder of c:\windows\microsoft.net
<?xml version="1.0"?> <configuration> <configsections> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler,log4net" /> </configsections> <appsettings> .... </appsettings> <log4net> <root> ..... </root> <appender name="logfileappender" type="log4net.appender.rollingfileappender"> ..... </appender> </log4net> <system.servicemodel> .... </system.servicemodel> </configuration>
also sure config file starts <?xml version="1.0"?>
Comments
Post a Comment