[Fat fingers]
I cannot get is to work. What I want:
@PluginElement("Thing")
private String[] things;
For simple things:
<Thin\g>Thing1,Thing2<Thing>
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]>
>>
>>
>>