You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Tavis Bones <ta...@gmail.com> on 2011/01/21 20:57:36 UTC

ODBCAppender with sqlite3

I'm trying to figure out how to use the ODBCAppender using sqlite3.  What
would the xml look like?  What would be in the param of URL? Is that even
needed?

For example:

 <appender name="testSqliteAppender"
class="org.apache.log4j.odbc.ODBCAppender">

 <param name="URL" value="Driver={sqlite3};Server=localhost
;Port=5432;Database=errorlog;Uid=sqlite3;Pwd=abc123;"/>

  <layout class="org.apache.log4j.PatternLayout">

  <param name="ConversionPattern" value="INSERT INTO errorlog (errormessage)
VALUES ('%d - %c - %p -%m')"/>

  </layout>

  </appender>

Re: ODBCAppender with sqlite3

Posted by Curt Arnold <ca...@apache.org>.
I don't have any personal experience with the ODBCAppender at all and can't recall ODBC+SQLite coming up before but I didn't check the archive myself.  

Doing a quick search, it appears that ODBC support can be provided by several third party software.  Likely the configuration strings would vary depending on which ODBC for SQLite implementation you used.  Since, as far as I can tell, they aren't socket-based, specifying ports seems at best meaningless.

Seems like a better path forward would be to write a custom appender for SQLite bypassing a third-party ODBC driver.  LOGCXX-101 was someone's effort to do that for MySQL.  If there were to be an appender add to log4cxx proper, I would suggest using APR's database abstraction layer as suggested in LOGCXX-61.



https://issues.apache.org/jira/browse/LOGCXX-61
https://issues.apache.org/jira/browse/LOGCXX-101

On Jan 21, 2011, at 1:57 PM, Tavis Bones wrote:

> I'm trying to figure out how to use the ODBCAppender using sqlite3.  What would the xml look like?  What would be in the param of URL? Is that even needed?
> 
> For example:
> 
>  <appender name="testSqliteAppender" class="org.apache.log4j.odbc.ODBCAppender">
> 
>  <param name="URL" value="Driver={sqlite3};Server=localhost;Port=5432;Database=errorlog;Uid=sqlite3;Pwd=abc123;"/>
> 
>  	<layout class="org.apache.log4j.PatternLayout">
> 
>  	<param name="ConversionPattern" value="INSERT INTO errorlog (errormessage) VALUES ('%d - %c - %p -%m')"/>
> 
>  	</layout>
> 
>   </appender> 
> 
>