Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
Logging Log4j2
Commits
56db9a00
Commit
56db9a00
authored
6 years ago
by
Gary Gregory
Browse files
Options
Download
Email Patches
Plain Diff
[LOG4J2-2508] JDBC Appender fails when using both parameter, source, and
literal ColumnMapping elements.
parent
8025e3fa
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
+11
-8
...ging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
src/changes/changes.xml
+3
-0
src/changes/changes.xml
with
14 additions
and
8 deletions
+14
-8
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
+
11
-
8
View file @
56db9a00
...
...
@@ -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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/changes/changes.xml
+
3
-
0
View file @
56db9a00
...
...
@@ -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"
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help