logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rifel <pri...@mixpo.com>
Subject Log4j2: Column casting in JDBCAppender
Date Thu, 22 Aug 2013 21:12:13 GMT

I'm wondering if it is at all possible to cast columns to a certain type (a custom enum) with
the JDBCAppender.  I have an existing PostgreSQL database that I send all warnings and errors
to and the log level is currently being stored as an enum.  When I try and log to the database
I get the following message:

org.postgresql.util.PSQLException: ERROR: column "level" is of type log_level but expression
is of type character varying  Hint: You will need to rewrite or cast the expression.

Looking through the JDBCDatabaseManager it doesn't appear that this is possible; including
the cast in the pattern string results in it getting passed as the value itself rather than
the prepared statement.  Does anyone have any other ideas on how to accomplish this?  I wouldn't
mind making contributions to the source code to help implement this feature if it is desired.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message