log4net - Configure Nhibernate log into file -
i have programmatically create log4net log config file:
var properties = new namevaluecollection { {"configtype", "file"}, {"configfile", @"c:/log4net.config"} }; common.logging.logmanager.adapter = new common.logging.log4net.log4netloggerfactoryadapter(properties);
this log4net.config
(edited simplicity dove suggested) :
<log4net> <appender name="rollingfile" type="log4net.appender.rollingfileappender"> <file value="c:/log.log" /> <appendtofile value="true" /> <maximumfilesize value="100kb" /> <maxsizerollbackups value="5" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%d [%t] %-5p %c - %m%n" /> </layout> </appender> <root> <level value="all" /> <appender-ref ref="rollingfile" /> </root> <logger name="nhibernate"> <level value="all" /> <appender-ref ref="rollingfile" /> </logger> </log4net>
i got spring.net successfuly logging file, not nhibernate. nhibernate configured fluenltly:
protected override void postprocessconfiguration(configuration config) { base.postprocessconfiguration(config); var mssqlcfg = mssqlconfiguration.mssql2000.connectionstring(connectionstring) .showsql(); fluently.configure(config).database(mssqlcfg) .mappings(m => m.fluentmappings.add<employeemap>()) // other mappings .buildsessionfactory(); }
what should fix nhibernate log working?
does log if generate statistics?
configuration.exposeconfiguration(c => c.setproperty("generate_statistics", "true"));
to narrow things down can remove additivity flag , appeder within logger , log 1 start, i.e. this
<logger name="nhibernate"> <level value="all" /> </logger>
Comments
Post a Comment