Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 30A3F200BB3 for ; Tue, 18 Oct 2016 17:27:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2F31E160AE5; Tue, 18 Oct 2016 15:27:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7803D160ACE for ; Tue, 18 Oct 2016 17:26:59 +0200 (CEST) Received: (qmail 18444 invoked by uid 500); 18 Oct 2016 15:26:58 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 18421 invoked by uid 99); 18 Oct 2016 15:26:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2016 15:26:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6C4EF2C4C78 for ; Tue, 18 Oct 2016 15:26:58 +0000 (UTC) Date: Tue, 18 Oct 2016 15:26:58 +0000 (UTC) From: "Badreddine BENAIDJA (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-424) JDBCAppender: Add support for data types other then String MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 18 Oct 2016 15:27:00 -0000 [ https://issues.apache.org/jira/browse/LOG4J2-424?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1558= 5747#comment-15585747 ]=20 Badreddine BENAIDJA commented on LOG4J2-424: -------------------------------------------- [~mikael.staldal@home.se] you mean Thread Context ? > JDBCAppender: Add support for data types other then String > ---------------------------------------------------------- > > Key: LOG4J2-424 > URL: https://issues.apache.org/jira/browse/LOG4J2-424 > Project: Log4j 2 > Issue Type: Improvement > Components: Appenders > Affects Versions: 2.0-beta9 > Environment: All > Reporter: Tihomir Me=C5=A1=C4=8Di=C4=87 > Assignee: Nick Williams > > I am using the JDBCAppender to log to a Postgresql database. I have a tab= le (log_entries) that's used for logging purposes.=20 > One of the attributes is of type INTEGER. The attribute is something spec= ific for our application and we are using ThreadContext (MDC) to set the va= lue of the parameter. > Currently, log4j provides no support for integer type attributes in the C= olumn element of the JDBC appender configuration (the only types supported = are string (default), timestamp - isEventTimestamp flag and Clob - isClob f= lag). > When using the default settings in the Column element of the JDBC appende= r, log4j will create a prepared statement and try to set the value using th= e Statement.setString() method. Of course, the JDBC driver throws an except= ion: > Caused by: org.postgresql.util.PSQLException: ERROR: column "mn_type_d" i= s of type integer but expression is of type character varying > Hint: You will need to rewrite or cast the expression. > My appender configuration: > > > > =20 > ..... > > <-- this is of type integer in the DB but LOG4J tries to insert it= as a String --> > -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org