关于Log4net无法利用Oracle.DataAccess写日志到数据库的问题。
<connectionType value="Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess,
Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<connectionString value="Data Source=databasename;User ID=username;Password=password;" />
<commandText value="INSERT INTO Log (Datetime,Thread,Log_Level,Logger,Message)
VALUES (:log_date, :thread, :log_level, :logger, :message)" />
<bufferSize value="128" />
<parameter>
<parameterName value=":log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value=":thread" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%thread" />
</layout>
</parameter>
<parameter>
<parameterName value=":log_level" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level" />
</layout>
</parameter>
<parameter>
<parameterName value=":logger" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%logger" />
</layout>
</parameter>
<parameter>
<parameterName value=":message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
</appender>
。。。。
程序运行无错误也无反应,请高手解决答!!!
------解决方案--------------------
我最后的解决方式:
<log4net>
<appender name="AdoNetAppender_Oracle" type="LogClass">
<connectionType value="System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<!--<connectionString value="data source=orcl;User ID=sysjyptdba;Password=123456" />-->
<commandText value="INSERT INTO SYS_LOG (LOGID, LOGDATE, THREAD, LOGLEVEL, LOGGER, MESSAGE) VALUES (sys_guid(), :log_date, :thread, :log_level, :logger, :message)" />
<bufferSize value="20" />
<parameter>
<parameterName value=":log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value=":thread" />
<dbType value="String" />
<size value="255" />