I decided the following:
I copied the source code of JDBCAppender called ACMEJDBCAppender
override the getLogStatement(LoggingEvent event) method, cloning the old event and providing a new message with a shielded message.
Not the cleanest solution from an oop point of view, but it does the job. Hope this helps.
protected String getLogStatement(LoggingEvent event) { LoggingEvent clone = new LoggingEvent( event.fqnOfCategoryClass, LogManager.getLogger(event.getLoggerName()), event.getLevel(), AidaUtils.sqlEscape(event.getMessage().toString()), event.getThrowableInformation()!=null ? event.getThrowableInformation().getThrowable() : null ); return getLayout().format(clone); }
source share