Thanks Kevin!

This worked out perfect, I was able to write to database without a
problem...

-----Original Message-----
From: Kevin [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 05, 2020 12:13 PM
To: [EMAIL PROTECTED]
Subject: JDBCAppender update


I spent a lot of time yesterday updating my JDBCAppender.
Looks like that was appropriate timing.

The new version of my appender has bean-like get/set methods
(plus the now deprecated setOption methods).
Setting a database driver is a new option.

Most valuably though I've made the sql setting much more
powerful.  You can now use all the conversion patterns from
PatternLayout within the configured statement to separate
items into different columns and the like ie:

log4j.appender.jdbc.sql=insert into logTable (message,
class, priority, log_date) values ('%m', '%c', '%p', '%d')

or

log4j.appender.jdbc.sql=insert into logTable
(class_and_message, priority) values ('%c %m', '%p')

optionally you can explicitly attach a Layout and it's
output from format(LoggingEvent) will replace any "%m" in
your sql.  And as always it's easy to subclass and override
for even more control.

The JDBCAppender class, two example classes, and an example
properties file are attached.
I'll be putting up an additional web page about it all on my
own server in a few days.  I'll let you know when that
happens.

Ceki, I tried to keep my indenting close to your standard
this time.  I hope it helps.

Kevin Steppe

ps. I'm looking for work if anyone is hiring in the SF Bay
Area.


*****************************************************************
DISCLAIMER:   The information contained in this e-mail may be confidential
and is intended solely for the use of the named addressee.  Access, copying
or re-use of the e-mail or any information contained therein by any other
person is not authorized.  If you are not the intended recipient please
notify us immediately by returning the e-mail to the originator.    

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

Reply via email to