Hello,
I'm trying to save log messages to a central database. In order to do this, I configured the following Appender in log4j's xml configuration:
<appender name="DB" class="org.apache.log4j.jdbc.JDBCAppender">
<param name="URL" value="jdbc:postgresql://localhost/logging_test" />
<param name="user" value="test_user" />
<param name="password" value="test_password" />
<param name="sql" value="INSERT INTO log_messages ( log_level, message, log_date ) VALUES ( '%p', '%m', '%d{yyyy-MM-dd HH:mm:ss}' )" />
</appender>
This works fine, except some of the messages contain ', and then the appender fails.
Is there an easy way to do this?