You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Paolo Bonanomi (JIRA)" <ji...@apache.org> on 2018/11/26 13:05:00 UTC

[jira] [Closed] (LOG4J2-2466) ColumnMapping literal not working

     [ https://issues.apache.org/jira/browse/LOG4J2-2466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paolo Bonanomi closed LOG4J2-2466.
----------------------------------

Ok!

> ColumnMapping literal not working
> ---------------------------------
>
>                 Key: LOG4J2-2466
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2466
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.11.1
>            Reporter: Paolo Bonanomi
>            Assignee: Gary Gregory
>            Priority: Major
>             Fix For: 3.0.0, 2.11.2
>
>
> If i set a literal value in column mapping:
> <Jdbc name="..." tableName="..." ....>
>  <DataSource jndiName="...." />
>  <ColumnMapping name="...." />
>  <ColumnMapping name="my_col" literal="'my_value'" />
> ....
> generated sql is wrong:
> INSERT INTO ... (..) VALUES (?, ... {color:#FF0000}'myvalue'?{color}, ...)
>  
> I think the problem should be in class JdbcDatabaseManager, row 374. Maybe an else is missing. Please check.
>  
> for (final ColumnMapping mapping : data.columnMappings) {
>  final String mappingName = mapping.getName();
>  if (Strings.isNotEmpty(mapping.getLiteralValue())) {
>  logger().trace("Adding INSERT VALUES literal for ColumnMapping[{}]: {}={} ", i, mappingName, mapping.getLiteralValue());
>  sb.append(mapping.getLiteralValue());
>  }
> {color:#FF0000}*** missing else ***{color} if (Strings.isNotEmpty(mapping.getParameter())) {
>  logger().trace("Adding INSERT VALUES parameter for ColumnMapping[{}]: {}={} ", i, mappingName, mapping.getParameter());
>  sb.append(mapping.getParameter());
>  columnMappings.add(mapping);
>  } else {
>  logger().trace("Adding INSERT VALUES parameter marker for ColumnMapping[{}]: {}={} ", i, mappingName, PARAMETER_MARKER);
>  sb.append(PARAMETER_MARKER);
>  columnMappings.add(mapping);
>  }
>  sb.append(',');
>  i++;
> }
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)