What do you mean “Things” does not have a plugin to match the name for that node?
Ralph > On Nov 14, 2018, at 7:42 PM, Gary Gregory <[email protected]> wrote: > > This does not work either: > > @PluginElement("Things") > private String[] things; > > <Things> > <String>Foo</String> > <String>Bar</String> > </Things> > > In > org.apache.logging.log4j.core.config.xml.XmlConfiguration.constructHierarchy(Node, > Element), when a "Things" Node that is supposed to map to a String[] is > processed it does not have a "type" because it does not have a plugin to > match the name for that node. When we call constructHierarchy for child > elements, the "String" nodes, these do not have types > despite > org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.StringConverter > being a @Plugin named "String". > > Is that a bug or am I on the wrong path? > > Gary > > > On Wed, Nov 14, 2018 at 6:42 PM Gary Gregory <[email protected]> wrote: > >> On Wed, Nov 14, 2018 at 6:39 PM Gary Gregory <[email protected]> >> wrote: >> >>> [Fat fingers] >>> >>> >>> I cannot get is to work. What I want: >>> >>> @PluginElement("Thing") >>> private String[] things; >>> >>> For simple things: >>> >>> <Thin\g>Thing1,Thing2<Thing> >>> >> >> Now that I've hit "Send", the "simple" things use-case is not worth it. >> It's better and cleaner to have separate elements. >> >> Gary >> >> >>> >>> For fancy things: >>> <Thing> >>> Thing1 >>> <Thing> >>> <Thing> >>> Thing2 >>> <Thing> >>> >>> Example: >>> >>> <Jdbc name="databaseAppender" tableName="TableNameA" >>> ignoreExceptions="false"> >>> <PoolingDriver >>> connectionString="jdbc:h2:${sys:java.io.tmpdir}/h2/h2_test0;TRACE_LEVEL_SYSTEM_OUT=0" >>> driverClassName="org.h2.Driver"> >>> <!-- PoolableConnectionFactory default values --> >>> <PoolableConnectionFactory >>> autoCommitOnReturn="true" >>> cacheState="false" >>> defaultAutoCommit="false" >>> defaultCatalog="" >>> defaultQueryTimeoutSeconds="0" >>> defaultReadOnly="false" >>> defaultTransactionIsolation="-1" >>> fastFailValidation="true" >>> maxConnLifetimeMillis="-1" >>> maxOpenPreparedStatements="8" >>> poolStatements="false" >>> rollbackOnReturn="true" >>> validationQuery="" >>> validationQueryTimeoutSeconds="-1"> >>> <DisconnectionSqlCode>1</DisconnectionSqlCode> >>> <DisconnectionSqlCode>2</DisconnectionSqlCode> >>> </PoolableConnectionFactory> >>> </PoolingDriver> >>> <ColumnMapping name="ColumnA" /> >>> </Jdbc> >>> >>> Thoughts? >>> >>> Gary >>> >>> On Wed, Nov 14, 2018 at 6:36 PM Gary Gregory <[email protected]> >>> wrote: >>> >>>> On Wed, Nov 14, 2018 at 1:10 PM Ralph Goers <[email protected]> >>>> wrote: >>>> >>>>> If you look at the FailoversPlugin you will see how it creates an array >>>>> of Strings containing appender names. I’m not sure if that is what you are >>>>> trying to do or not. >>>>> >>>> >>>> I cannot get is to work. What I want: >>>> >>>> @PluginElement("Things") >>>> private String[] things; >>>> >>>> In Config: >>>> <Things> >>>> ? >>>> <Things> >>>> >>>> For simple things: >>>> >>>> <Things>Thing1,Thing2<Things> >>>> >>>> For fancy things: >>>> <Things> >>>> <Thing> >>>> This, that, and the other >>>> >>>> >>>>> >>>>> Ralph >>>>> >>>>>> On Nov 14, 2018, at 12:36 PM, Matt Sicker <[email protected]> wrote: >>>>>> >>>>>> Looks like in here: >>>>>> >>>>> https://github.com/apache/logging-log4j2/tree/master/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors >>>>>> >>>>>> It looks like it's allowed in some way, but I'm not sure what the >>>>> syntax in >>>>>> XML vs JSON would be. See PluginElementVisitor for that annotation. >>>>> These >>>>>> classes could probably use better names as they're strategies, not >>>>> visitors. >>>>>> >>>>>> On Wed, 14 Nov 2018 at 12:52, Gary Gregory <[email protected]> >>>>> wrote: >>>>>> >>>>>>> I cannot seem to get this to work: >>>>>>> >>>>>>> @PluginElement("DisconnectionSqlCodes") >>>>>>> private String[] disconnectionSqlCodes; >>>>>>> >>>>>>> Is it supposed? Where is the code is this done? >>>>>>> >>>>>>> Gary >>>>>>> >>>>>>> >>>>>>> On Tue, Nov 13, 2018 at 1:55 PM Gary Gregory <[email protected] >>>>>> >>>>>>> wrote: >>>>>>> >>>>>>>> This is to support configuring an Apache Commons DBCP connection >>>>> pool >>>>>>>> through a org.apache.commons.dbcp2.PoolableConnectionFactory in our >>>>>>>> >>>>>>> >>>>> org.apache.logging.log4j.core.appender.db.jdbc.PoolingDriverConnectionSource, >>>>>>>> and there are a bunch of settings you can configure: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>> https://commons.apache.org/proper/commons-dbcp/apidocs/org/apache/commons/dbcp2/PoolableConnectionFactory.html >>>>>>>> >>>>>>>> And I'd rather support all settings than cherry-pick. >>>>>>>> >>>>>>>> Reference: https://issues.apache.org/jira/browse/LOG4J2-2505 >>>>>>>> >>>>>>>> Gary >>>>>>>> >>>>>>>> On Tue, Nov 13, 2018 at 1:51 PM Ralph Goers < >>>>> [email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> You want to put a list of SQL statements into a log4j2 >>>>> configuration? >>>>>>> I’m >>>>>>>>> not sure why but something about that makes me uncomfortable. >>>>>>>>> >>>>>>>>> Ralph >>>>>>>>> >>>>>>>>>> On Nov 13, 2018, at 11:20 AM, Gary Gregory < >>>>> [email protected]> >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> On Tue, Nov 13, 2018 at 9:47 AM Matt Sicker <[email protected]> >>>>> wrote: >>>>>>>>>> >>>>>>>>>>> That might already be supported for comma-separated lists. IIRC, >>>>> it >>>>>>>>> should >>>>>>>>>>> have conversions for Collection and array types. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> I one case, a comma separated list would work for a list of >>>>> numbers >>>>>>> but >>>>>>>>> in >>>>>>>>>> the other case I need a list of SQL statements, so that would not >>>>>>> work, >>>>>>>>> I'd >>>>>>>>>> need separate elements. >>>>>>>>>> >>>>>>>>>> Gary >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Tue, 13 Nov 2018 at 10:44, Gary Gregory < >>>>> [email protected]> >>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>>> Thank you Matt for the quick reply. >>>>>>>>>>>> >>>>>>>>>>>> Ah, I do want a null if there is nothing in the config for an >>>>>>>>> Integer, so >>>>>>>>>>>> it is perfect! >>>>>>>>>>>> >>>>>>>>>>>> What if I want a Collection<String> or something I can convert >>>>> to >>>>>>>>> that? >>>>>>>>>>> How >>>>>>>>>>>> do I do that? >>>>>>>>>>>> >>>>>>>>>>>> Gary >>>>>>>>>>>> >>>>>>>>>>>> On Tue, Nov 13, 2018 at 9:36 AM Matt Sicker <[email protected]> >>>>>>> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Yeah, it should work fine for those, too. If you don't specify >>>>> a >>>>>>>>>>> default >>>>>>>>>>>>> field value, though, the default will be null instead of >>>>> false/0 as >>>>>>>>> you >>>>>>>>>>>>> might expect with boxed types. >>>>>>>>>>>>> >>>>>>>>>>>>> On Tue, 13 Nov 2018 at 10:28, Gary Gregory < >>>>> [email protected] >>>>>>>> >>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> Hi All: >>>>>>>>>>>>>> >>>>>>>>>>>>>> Will @PluginBuilderAttribute work OK for Boolean and Integers? >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thank you, >>>>>>>>>>>>>> Gary >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> -- >>>>>>>>>>>>> Matt Sicker <[email protected]> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> Matt Sicker <[email protected]> >>>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Matt Sicker <[email protected]> >>>>> >>>>> >>>>>
