在写完sql语句以后,如果参数有问题.还真不知道该如何看参数.原来Ibatis 是通过日志输出,看到参数的.IBatis 内置的日志输出是log4net,所以可以参考ibatis的api.照着复制其配置文件.其内容是
<configSections> <sectionGroup name="iBATIS"> <section name="logging" type="IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common" /> </sectionGroup> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <appSettings> <add key="log4net.Internal.Debug" value="true"/> </appSettings> <system.diagnostics> <trace autoflush="true"> <listeners> <add name="textWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\\inetpub\\wwwroot\\log4net.txt" /> </listeners> </trace> </system.diagnostics> <iBATIS> <logging> <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net"> <arg key="configType" value="inline" /> </logFactoryAdapter> </logging> </iBATIS> <log4net> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <param name="File" value="Log/" /> <param name="AppendToFile" value="true" /> <!-- 切割最多文件数 -1表示不限制产生日志文件数--> <param name="MaxSizeRollBackups" value="-1"/> <!-- 每个文件的大小限制 --> <param name="MaximumFileSize" value="10MB"/> <!-- RollingStyle Composite 综合 Size 按大小 Date 按时间 --> <param name="RollingStyle" value="Composite" /> <param name="DatePattern" value="""yyyyMMdd".txt"" /> <param name="StaticLogFileName" value="false" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net>
里面还有比较经典的配置log4net 是按日期输出文件的,并且不超过每天日志不超过10m.