pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedLog4j Appender
3+ messages / 2 participants
[nested] [flat]
* Log4j Appender
@ 2009-03-20 11:06 nenad.jaksic@imail.de
2009-03-21 03:37 ` Re: Log4j Appender Guy Rouillier <guyr-ml1@burntmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: nenad.jaksic@imail.de @ 2009-03-20 11:06 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
I'd like to use DBAppender or JDBCAppender to log to Postgres
DB, I am not sure if any can send me some peace of code or clue or link
how to do it. I also use Hibernete so I know
there is also way to connect it to Hibernate to but preference
is to make it with Log4j anyhow.
Does somebody knows the correct way?
Thanks!
--
Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt?
Jetzt absichern: https://homebanking.gmx.net/?mc=mail@footer.hb
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Log4j Appender
2009-03-20 11:06 Log4j Appender nenad.jaksic@imail.de
@ 2009-03-21 03:37 ` Guy Rouillier <guyr-ml1@burntmail.com>
2009-03-23 16:51 ` Re: Log4j Appender Guy Rouillier <guyr-ml1@burntmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Guy Rouillier @ 2009-03-21 03:37 UTC (permalink / raw)
To: pgsql-jdbc
nenad.jaksic@imail.de wrote:
> Hello,
>
> I'd like to use DBAppender or JDBCAppender to log to Postgres
> DB, I am not sure if any can send me some peace of code or clue or link
> how to do it. I also use Hibernete so I know
> there is also way to connect it to Hibernate to but preference
> is to make it with Log4j anyhow.
> Does somebody knows the correct way?
This works for me:
table:
----------------
create table log4j_messages
(
message varchar(2000),
class varchar(255),
priority varchar(64),
log_date timestamp
);
log4j.properties:
-----------------
### JDBC appender
# timestamp comes out like this: 2009-03-20 22:16:45,614
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.jdbc.driver=org.postgresql.Driver
log4j.appender.jdbc.URL=jdbc:postgresql://localhost:5432/postgres
log4j.appender.jdbc.user=xxxxx
log4j.appender.jdbc.password=yyyyy
log4j.appender.jdbc.sql=INSERT INTO log4j_messages (message, class,
priority, log_date) values ('%m', '%c', '%p', to_timestamp('%d',
'YYYY-MM-DD HH24:MI:SS,MS'))
--
Guy Rouillier
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Log4j Appender
2009-03-20 11:06 Log4j Appender nenad.jaksic@imail.de
2009-03-21 03:37 ` Re: Log4j Appender Guy Rouillier <guyr-ml1@burntmail.com>
@ 2009-03-23 16:51 ` Guy Rouillier <guyr-ml1@burntmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Guy Rouillier @ 2009-03-23 16:51 UTC (permalink / raw)
To: pgsql-jdbc
Nenad Jaksic wrote:
> Hello,
Please reply to the list and not to me individually.
> thanks, is it necessary also to adjust log level?
Not necessary. JDBCAppender is just an appender, like any other. It
will log whatever levels you tell it to.
> Also I' red that JDBCAppender does not log exceptions.
I see the same comment in the Javadoc. You can easily get around this
by just converting your exception to text.
>
> -------- Original-Nachricht --------
>> Datum: Fri, 20 Mar 2009 23:37:26 -0400
>> Von: Guy Rouillier <guyr-ml1@burntmail.com>
>> An: pgsql-jdbc@postgresql.org
>> Betreff: Re: [JDBC] Log4j Appender
>
>> nenad.jaksic@imail.de wrote:
>>> Hello,
>>>
>>> I'd like to use DBAppender or JDBCAppender to log to Postgres
>>> DB, I am not sure if any can send me some peace of code or clue or link
>>> how to do it. I also use Hibernete so I know
>>> there is also way to connect it to Hibernate to but preference
>>> is to make it with Log4j anyhow.
>>> Does somebody knows the correct way?
>> This works for me:
>>
>> table:
>> ----------------
>> create table log4j_messages
>> (
>> message varchar(2000),
>> class varchar(255),
>> priority varchar(64),
>> log_date timestamp
>> );
>>
>>
>> log4j.properties:
>> -----------------
>> ### JDBC appender
>> # timestamp comes out like this: 2009-03-20 22:16:45,614
>> log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender
>> log4j.appender.jdbc.driver=org.postgresql.Driver
>> log4j.appender.jdbc.URL=jdbc:postgresql://localhost:5432/postgres
>> log4j.appender.jdbc.user=xxxxx
>> log4j.appender.jdbc.password=yyyyy
>> log4j.appender.jdbc.sql=INSERT INTO log4j_messages (message, class,
>> priority, log_date) values ('%m', '%c', '%p', to_timestamp('%d',
>> 'YYYY-MM-DD HH24:MI:SS,MS'))
>>
>>
>> --
>> Guy Rouillier
>>
>> --
>> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc
>
--
Guy Rouillier
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2009-03-23 16:51 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20 11:06 Log4j Appender nenad.jaksic@imail.de
2009-03-21 03:37 ` Guy Rouillier <guyr-ml1@burntmail.com>
2009-03-23 16:51 ` Guy Rouillier <guyr-ml1@burntmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox