Commit 56db9a00 authored by Gary Gregory's avatar Gary Gregory
Browse files

[LOG4J2-2508] JDBC Appender fails when using both parameter, source, and

literal ColumnMapping elements.
parent 8025e3fa
No related merge requests found
Showing with 14 additions and 8 deletions
+14 -8
......@@ -482,15 +482,18 @@ public final class JdbcDatabaseManager extends AbstractDatabaseManager {
final String simpleName = statement.getClass().getName();
int i = 1; // JDBC indices start at 1
for (final ColumnMapping mapping : this.factoryData.columnMappings) {
final String source = mapping.getSource();
final String key = Strings.isEmpty(source) ? mapping.getName() : source;
final Object value = map.getValue(key);
if (logger().isTraceEnabled()) {
final String valueStr = value instanceof String ? "\"" + value + "\"" : Objects.toString(value, null);
logger().trace("{} setObject({}, {}) for key '{}' and mapping '{}'", simpleName, i, valueStr, key,
mapping.getName());
if (mapping.getLiteralValue() == null) {
final String source = mapping.getSource();
final String key = Strings.isEmpty(source) ? mapping.getName() : source;
final Object value = map.getValue(key);
if (logger().isTraceEnabled()) {
final String valueStr = value instanceof String ? "\"" + value + "\""
: Objects.toString(value, null);
logger().trace("{} setObject({}, {}) for key '{}' and mapping '{}'", simpleName, i, valueStr, key,
mapping.getName());
}
statement.setObject(i++, value);
}
statement.setObject(i++, value);
}
}
......
......@@ -127,6 +127,9 @@
<action issue="LOG4J2-2505" dev="ggregory" type="add">
Let JDBC PoolingDriverConnectionSource with Apache Commons DBCP configure a PoolableConnectionFactory.
</action>
<action issue="LOG4J2-2508" dev="ggregory" type="fix">
JDBC Appender fails when using both parameter, source, and literal ColumnMapping elements.
</action>
</release>
<release version="2.11.1" date="2018-07-22" description="GA Release 2.11.1">
<action issue="LOG4J2-2389" dev="rgoers" type="fix" due-to="Liu Wen">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment