日期:2014-05-18  浏览次数:20883 次

Spring.net + NHibernate+Log4net配置问题
如何配置能够使Hibernate输出日志信息。如执行的sql语句等。现在配置后不能输出日志。
配置如下:
<configSections>
  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  <sectionGroup name="spring">
  <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
  </sectionGroup>
  </configSections>
  <log4net debug="false">
  <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
  <param name="File" value="Logs\Application.log.txt"/>
  <param name="datePattern" value="MM-dd HH:mm"/>
  <param name="AppendToFile" value="true"/>
  <layout type="log4net.Layout.PatternLayout">
  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
  </layout>
  </appender>
  <appender name="HttpTraceAppender" type="log4net.Appender.ASPNetTraceAppender">
  <layout type="log4net.Layout.PatternLayout">
  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
  </layout>
  </appender>
  <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
  <layout type="log4net.Layout.PatternLayout">
  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
  </layout>
  </appender>
  <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <param name="File" value="Logs\Log.txt"/>
  <param name="AppendToFile" value="true"/>
  <param name="MaxSizeRollBackups" value="10"/>
  <param name="MaximumFileSize" value="5MB"/>
  <param name="RollingStyle" value="Size"/>
  <param name="StaticLogFileName" value="true"/>
  <layout type="log4net.Layout.PatternLayout">
  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
  </layout>
  </appender>
  <root>
  <level value="INFO"/>
  <appender-ref ref="LogFileAppender"/>
  </root>
  </log4net>
  <spring>
  <context>
  <resource uri="file://~/Spring_Nhibernate.xml"/>
  </context>
  </spring>
  <appSettings/>
<connectionStrings/>

------解决方案--------------------
路过,帮订。。
------解决方案--------------------
顶~~~~~~~~~~~~~~~~~
------解决方案--------------------
帮顶
------解决方案--------------------
http://www.cnblogs.com/kfarvid/archive/2008/11/25/1340720.html
http://www.cnblogs.com/renrenqq/archive/2006/08/09/471788.html
------解决方案--------------------
http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/200836/103038.html