logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal ROZE <pascal.r...@gmail.com>
Subject Re: ADO.Net appender configuration for sybase?
Date Thu, 29 Jan 2009 11:16:07 GMT
Maybe DATE is a key word.
Try with [DATE]:

insert into EVENT_LOG([DATE], THREAD, LEVEL, LOGGER, MESSAGE, EXCEPTION)
values (?, ?, ?, ?, ?, ?)

2009/1/29 Ranjan, Bibhakar <Bibhakar_Ranjan@intuit.com>

>  I wrote the following appender
>
>
>
> <?xml version="1.0" encoding="utf-8" ?>
>
> <configuration>
>
>   <configSections>
>
>     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,
> log4net" />
>
>   </configSections>
>
>   <log4net>
>
>     <appender name="DatabaseAppender" type="
> log4net.Appender.AdoNetAppender">
>
>       <bufferSize value="0" />
>
>       <connectionString value="Provider=ASAProv.90;Eng=databasename;Uid=UserId;Pwd=Pwd;
> Links=tcpip" />
>
>       <commandText value="insert into EVENT_LOG(DATE, THREAD, LEVEL,
> LOGGER, MESSAGE, EXCEPTION) values (?, ?, ?, ?, ?, ?)" />
>
>       <parameter>
>
>         <parameterName value="@DATE" />
>
>         <dbType value="DateTime" />
>
>         <size value="255" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm}" />
>
>         </layout>
>
>       </parameter>
>
>       <parameter>
>
>         <parameterName value="@THREAD" />
>
>         <dbType value="AnsiString" />
>
>         <size value="500" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%THREAD" />
>
>         </layout>
>
>       </parameter>
>
>       <parameter>
>
>         <parameterName value="@LEVEL" />
>
>         <dbType value="AnsiString" />
>
>         <size value="500" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%property{LEVEL}" />
>
>         </layout>
>
>       </parameter>
>
>       <parameter>
>
>         <parameterName value="@LOGGER" />
>
>         <dbType value="AnsiString" />
>
>         <size value="500" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%property{LOGGER}" />
>
>         </layout>
>
>       </parameter>
>
>       <parameter>
>
>         <parameterName value="@MESSAGE" />
>
>         <dbType value="AnsiString" />
>
>         <size value="4000" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%property{MESSAGE}" />
>
>         </layout>
>
>       </parameter>
>
>       <parameter>
>
>         <parameterName value="@EXCEPTION" />
>
>         <dbType value="AnsiString" />
>
>         <size value="4000" />
>
>         <layout type="log4net.Layout.PatternLayout">
>
>           <conversionPattern value="%property{EXCEPTION}" />
>
>         </layout>
>
>       </parameter>
>
>     </appender>
>
>
>
>     <root>
>
>       <level value="DEBUG" />
>
>       <appender-ref ref="DatabaseAppender" />
>
>     </root>
>
>   </log4net>
>
> </configuration>
>
>
>
> I am getting the following error:
>
> log4net:ERROR [AdoNetAppender] Could not prepare database command [insert
> into EVENT_LOG(DATE, THREAD, LEVEL, LOGGER, MESSAGE, EXCEPTION) values (?,
> ?, ?, ?, ?, ?)]
>
> System.Data.OleDb.OleDbException: Syntax error near 'DATE' on line 1
>
>    at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32
> expectedExecutionCount)
>
>    at System.Data.OleDb.OleDbCommand.Prepare()
>
>    at log4net.Appender.AdoNetAppender.InitializeDatabaseCommand()
>  ------------------------------
>
> *From:* Pascal ROZE [mailto:pascal.roze@gmail.com]
> *Sent:* Thursday, January 29, 2009 1:53 PM
>
> *To:* Log4NET User
> *Subject:* Re: ADO.Net appender configuration for sybase?
>
>
>
> Here a config file for Sybase that works for us:
> You can see that we have to specify the Interfaces File path
>
> <appender name="DatabaseAppender" type="log4net.Appender.AdoNetAppender">
>             <bufferSize value="0" />
>             <connectionString value="Provider=Sybase ASE OLE DB
> Provider;Interfaces File Server Name=SYBREC_MINET;User
> ID=w_miin;Password=w_miin;Interfaces
> File=C:\Progra~1\Sybclient\oc_1251\ini\sql.ini;" />
>             <commandText value="insert into TradingLog_t (logDate, thread,
> tradeRef, logger, opCaract, errorMessage, customerMessage, statut,
> productType) values (?, ?, ?, ?, ?, ?, ?, ?, ?)" />
>             <parameter>
>                 <parameterName value="@logDate" />
>                 <dbType value="DateTime" />
>                 <size value="255" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%date{yyyy'-'MM'-'dd
> HH':'mm}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@thread" />
>                 <dbType value="AnsiString" />
>                 <size value="10" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%thread" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@tradeRef" />
>                 <dbType value="AnsiString" />
>                 <size value="25" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{tradeRef}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@logger" />
>                 <dbType value="AnsiString" />
>                 <size value="25" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{logger}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@opCaract" />
>                 <dbType value="AnsiString" />
>                 <size value="500" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{errorBody}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@errorMessage" />
>                 <dbType value="AnsiString" />
>                 <size value="512" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{message}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@customerMessage" />
>                 <dbType value="AnsiString" />
>                 <size value="512" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{customerMessage}"
> />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@statut" />
>                 <dbType value="AnsiString" />
>                 <size value="10" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{statut}" />
>                 </layout>
>             </parameter>
>             <parameter>
>                 <parameterName value="@productType" />
>                 <dbType value="AnsiString" />
>                 <size value="20" />
>                 <layout type="log4net.Layout.PatternLayout">
>                     <conversionPattern value="%property{productType}" />
>                 </layout>
>             </parameter>
>         </appender>
>
>
>
>  2009/1/29 Ranjan, Bibhakar <Bibhakar_Ranjan@intuit.com>
>
> iAnywhere.Data.AsaClient.AsaConnection
>
>
>
>
>  ------------------------------
>
> *From:* Ron Grabowski [mailto:rongrabowski@yahoo.com]
> *Sent:* Thursday, January 29, 2009 2:02 AM
> *To:* Log4NET User
> *Subject:* Re: ADO.Net appender configuration for sybase?
>
>
>
> What Sybase type implements IConnection?
>
>
>  ------------------------------
>
> *From:* "Ranjan, Bibhakar" <Bibhakar_Ranjan@intuit.com>
> *To:* log4net-user@logging.apache.org
> *Sent:* Wednesday, January 28, 2009 6:21:32 AM
> *Subject:* ADO.Net appender configuration for sybase?
>
> In log4net configuration, we have found sample xml code for most of the
> common RDBMS except Sybase.
>
>
>
> Could you please tell me how can I configure the Sybase database with
> log4net using ADONet appender?
>
>
>
> Thanks
>
> Bibhakar
>
>
>

Mime
View raw message