Set up the JDBCAppender in your config.  Then use log4j as you would with any other
appender.  This is important because you should easily be able to change to logging
into a file, JMS sink, console, or database.

Here is an example properties file to set up the JDBCAppender as your root appender:

# An example config file for JDBCAppender:
log4j.rootCategory=DEBUG, jdbc

# JDBCAppender writes messages into the database
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender

#SQL statement to be used (with multiple columns formated)
log4j.appender.jdbc.sql=insert into logTable (message, class, priority, log_date)
values ('%m', '%c', '%p', '%d')

# DB Options
log4j.appender.jdbc.URL=jdbc:odbc:myDB
log4j.appender.jdbc.user=me
log4j.appender.jdbc.password=password

#set the buffer size
log4j.appender.JDBC.buffersize=1



"Shanmugam, Balajee" wrote:

> Hi All,
>
> Can somebody send me the sample code using JDBC Appender . Or direct me as where
> can i find them ...
>
> Regards,
>
> Balajee
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to