You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Tamás Misik (JIRA)" <ji...@apache.org> on 2018/03/05 10:03:00 UTC
[jira] [Commented] (LOG4J2-1839) JdbcAppender.createAppender
deprecated
[ https://issues.apache.org/jira/browse/LOG4J2-1839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16385882#comment-16385882 ]
Tamás Misik commented on LOG4J2-1839:
-------------------------------------
Assertion in {{org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender.Builder.build()}} requires either
{{columnConfigs OR }}{{columnMappings}} to be provided, though, {{org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.JdbcDatabaseManagerFactory.createManager(String, FactoryData)}} wants to iterate over on BOTH object without doing a null check as described by the reporter. Tested with v2.10.0
> JdbcAppender.createAppender deprecated
> --------------------------------------
>
> Key: LOG4J2-1839
> URL: https://issues.apache.org/jira/browse/LOG4J2-1839
> Project: Log4j 2
> Issue Type: Improvement
> Components: Appenders
> Affects Versions: 2.8.1
> Reporter: Krzysztof Szymko
> Priority: Major
>
> As I was migrating 2.7 to 2.8.1 I followed JdbcAppender.<B>newBuilder() API to build JDBC appender:
> return JdbcAppender.<B>newBuilder()
> .setBufferSize(bufferSizeInt)
> .setColumnConfigs(columnConfigs)
> .setConnectionSource(connectionSource)
> .setTableName(tableName)
> .withName(name)
> .withIgnoreExceptions(ignoreExceptions)
> .withFilter(filter)
> .build();
> But then I got NPE from JdbcDatabaseManagerFactory @ 275, since
> I did not set any columnMappings. After providing
> .setColumnMappings(columnMappingJDBC)
> to my builder it worked OK. I would suggest to either improve the javadoc or add NULL check in JdbcDatabaseManagerFactory.createManager
> as JdbcAppender javadoc says that ColumnMapping is optional:
> This Appender writes logging events to a relational database using standard JDBC mechanisms. It takes a list of
> * {@link ColumnConfig}s and/or {@link ColumnMapping}s with
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)