Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8637F6335C7 for ; Mon, 23 Mar 2009 13:51:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 56373-04 for ; Mon, 23 Mar 2009 13:51:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx02.burntmail.com (7a.3f.5746.static.theplanet.com [70.87.63.122]) by mail.postgresql.org (Postfix) with ESMTP id B71B2633465 for ; Mon, 23 Mar 2009 13:51:30 -0300 (ADT) Received: from pool-173-79-55-100.washdc.fios.verizon.net ([173.79.55.100] helo=[127.0.0.1]) by mx02.burntmail.com with esmtpa (Exim 4.63) (envelope-from ) id 1LlnMn-0005Ok-0V for pgsql-jdbc@postgresql.org; Mon, 23 Mar 2009 11:51:13 -0500 Message-ID: <49C7BDFB.40703@burntmail.com> Date: Mon, 23 Mar 2009 12:51:07 -0400 From: Guy Rouillier User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Log4j Appender References: <20090320110636.322130@gmx.net> <49C460F6.6070603@burntmail.com> <20090323070650.286450@gmx.net> In-Reply-To: <20090323070650.286450@gmx.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 090322-0, 03/22/2009), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/111 X-Sequence-Number: 19441 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 >> 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