You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2014/07/07 18:37:09 UTC

Config element name confusion

I see:

org.apache.logging.log4j.core.filter.CompositeFilter.createFilters(Filter[]):

    @PluginFactory
    public static CompositeFilter createFilters(@PluginElement("Filters")
final Filter[] filters) {

Which is clear, but then I see:

    public static FileAppender createAppender(
            // @formatter:off
...
            @PluginElement("Filters") final Filter filter,
...

So it seems like one filter elements (not arrays) should be renamed from
"Filters" to "Filter".

That or the discrepancy between the plural name and singular element needs
to be in the Javadoc.

Thoughts?


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Config element name confusion

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Jul 8, 2014 at 11:18 AM, Ralph Goers <ra...@dslextreme.com>
wrote:

>
> On Jul 8, 2014, at 7:49 AM, Gary Gregory <ga...@gmail.com> wrote:
>
> On Tue, Jul 8, 2014 at 10:47 AM, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
>>
>> On Jul 8, 2014, at 7:32 AM, Gary Gregory <ga...@gmail.com> wrote:
>>
>> On Mon, Jul 7, 2014 at 1:44 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>>> Well, If there is only one Filter then it would just be declared. If
>>> there is more than one then it should be:
>>>
>>> <Filters>
>>>   <Filter>…</Filter>
>>>   <Filter>…</Filter>
>>> <Filters>
>>>
>>> Even in this case since there is only the CompositeFilter (which
>>> contains the other Filters) there should only be one Filter and it should
>>> be declared as PluginElement(“Filter”).  The only place
>>> PluginElement(“Fitlers”) should be used is on CompositeFilter.
>>>  FileAppender would be wrong to have “Filters” specified.
>>>
>>
>> Double checking:
>>
>> - The PluginElement on CompositeFilter typed as Filter[] should be named
>> "Filters" (plural). This is the only Filter[] PluginElement. This does not
>> need fixing.
>> - All PluginElement usage typed as Filter should be named "Filter"
>> (singular). This means fixing some call sites.
>>
>>
>> call sites?  Do you mean tests?
>>
>
> I mean:
>
> - methods annotated with @PluginElemen("Filters") that should be renamed
> to @PluginElemen("Filter")
> - test config files
>
>
> OK
>

In SVN now. Oddly, I did not have to change XML config files. All (?) seem
to use a composite filter.

Gary


>
> Ralph
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Config element name confusion

Posted by Ralph Goers <ra...@dslextreme.com>.
On Jul 8, 2014, at 7:49 AM, Gary Gregory <ga...@gmail.com> wrote:

> On Tue, Jul 8, 2014 at 10:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> On Jul 8, 2014, at 7:32 AM, Gary Gregory <ga...@gmail.com> wrote:
> 
>> On Mon, Jul 7, 2014 at 1:44 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> Well, If there is only one Filter then it would just be declared. If there is more than one then it should be:
>> 
>> <Filters>
>>   <Filter>…</Filter>
>>   <Filter>…</Filter>
>> <Filters>
>> 
>> Even in this case since there is only the CompositeFilter (which contains the other Filters) there should only be one Filter and it should be declared as PluginElement(“Filter”).  The only place PluginElement(“Fitlers”) should be used is on CompositeFilter.  FileAppender would be wrong to have “Filters” specified.
>> 
>> Double checking: 
>> 
>> - The PluginElement on CompositeFilter typed as Filter[] should be named "Filters" (plural). This is the only Filter[] PluginElement. This does not need fixing.
>> - All PluginElement usage typed as Filter should be named "Filter" (singular). This means fixing some call sites.
> 
> call sites?  Do you mean tests?
> 
> I mean: 
> 
> - methods annotated with @PluginElemen("Filters") that should be renamed to @PluginElemen("Filter")
> - test config files

OK

Ralph



Re: Config element name confusion

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Jul 8, 2014 at 10:47 AM, Ralph Goers <ra...@dslextreme.com>
wrote:

>
> On Jul 8, 2014, at 7:32 AM, Gary Gregory <ga...@gmail.com> wrote:
>
> On Mon, Jul 7, 2014 at 1:44 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
>> Well, If there is only one Filter then it would just be declared. If
>> there is more than one then it should be:
>>
>> <Filters>
>>   <Filter>…</Filter>
>>   <Filter>…</Filter>
>> <Filters>
>>
>> Even in this case since there is only the CompositeFilter (which contains
>> the other Filters) there should only be one Filter and it should be
>> declared as PluginElement(“Filter”).  The only place
>> PluginElement(“Fitlers”) should be used is on CompositeFilter.
>>  FileAppender would be wrong to have “Filters” specified.
>>
>
> Double checking:
>
> - The PluginElement on CompositeFilter typed as Filter[] should be named
> "Filters" (plural). This is the only Filter[] PluginElement. This does not
> need fixing.
> - All PluginElement usage typed as Filter should be named "Filter"
> (singular). This means fixing some call sites.
>
>
> call sites?  Do you mean tests?
>

I mean:

- methods annotated with @PluginElemen("Filters") that should be renamed to
@PluginElemen("Filter")
- test config files

Gary

>
> Ralph
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Config element name confusion

Posted by Ralph Goers <ra...@dslextreme.com>.
On Jul 8, 2014, at 7:32 AM, Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Jul 7, 2014 at 1:44 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> Well, If there is only one Filter then it would just be declared. If there is more than one then it should be:
> 
> <Filters>
>   <Filter>…</Filter>
>   <Filter>…</Filter>
> <Filters>
> 
> Even in this case since there is only the CompositeFilter (which contains the other Filters) there should only be one Filter and it should be declared as PluginElement(“Filter”).  The only place PluginElement(“Fitlers”) should be used is on CompositeFilter.  FileAppender would be wrong to have “Filters” specified.
> 
> Double checking: 
> 
> - The PluginElement on CompositeFilter typed as Filter[] should be named "Filters" (plural). This is the only Filter[] PluginElement. This does not need fixing.
> - All PluginElement usage typed as Filter should be named "Filter" (singular). This means fixing some call sites.

call sites?  Do you mean tests?

Ralph



Re: Config element name confusion

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jul 7, 2014 at 1:44 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Well, If there is only one Filter then it would just be declared. If there
> is more than one then it should be:
>
> <Filters>
>   <Filter>…</Filter>
>   <Filter>…</Filter>
> <Filters>
>
> Even in this case since there is only the CompositeFilter (which contains
> the other Filters) there should only be one Filter and it should be
> declared as PluginElement(“Filter”).  The only place
> PluginElement(“Fitlers”) should be used is on CompositeFilter.
>  FileAppender would be wrong to have “Filters” specified.
>

Double checking:

- The PluginElement on CompositeFilter typed as Filter[] should be named
"Filters" (plural). This is the only Filter[] PluginElement. This does not
need fixing.
- All PluginElement usage typed as Filter should be named "Filter"
(singular). This means fixing some call sites.

Gary


> Ralph
>
>
> On Jul 7, 2014, at 9:57 AM, Gary Gregory <ga...@gmail.com> wrote:
>
> This one would not need to be fixed:
> org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender:
>
>     @PluginFactory
>     public static RollingFileAppender createAppender(
> ...
>             @PluginElement("Filter") final Filter filter,
> ...
>
> So we do have some inconsistencies.
>
>
> Gary
>
>
> On Mon, Jul 7, 2014 at 12:37 PM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> I see:
>>
>>
>> org.apache.logging.log4j.core.filter.CompositeFilter.createFilters(Filter[]):
>>
>>     @PluginFactory
>>     public static CompositeFilter createFilters(@PluginElement("Filters")
>> final Filter[] filters) {
>>
>> Which is clear, but then I see:
>>
>>     public static FileAppender createAppender(
>>             // @formatter:off
>> ...
>>             @PluginElement("Filters") final Filter filter,
>> ...
>>
>> So it seems like one filter elements (not arrays) should be renamed from
>> "Filters" to "Filter".
>>
>> That or the discrepancy between the plural name and singular element
>> needs to be in the Javadoc.
>>
>> Thoughts?
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Config element name confusion

Posted by Ralph Goers <ra...@dslextreme.com>.
Well, If there is only one Filter then it would just be declared. If there is more than one then it should be:

<Filters>
  <Filter>…</Filter>
  <Filter>…</Filter>
<Filters>

Even in this case since there is only the CompositeFilter (which contains the other Filters) there should only be one Filter and it should be declared as PluginElement(“Filter”).  The only place PluginElement(“Fitlers”) should be used is on CompositeFilter.  FileAppender would be wrong to have “Filters” specified.

Ralph


On Jul 7, 2014, at 9:57 AM, Gary Gregory <ga...@gmail.com> wrote:

> This one would not need to be fixed: org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender:
> 
>     @PluginFactory
>     public static RollingFileAppender createAppender(
> ...
>             @PluginElement("Filter") final Filter filter,
> ...
> 
> So we do have some inconsistencies.
> 
> 
> Gary
> 
> 
> On Mon, Jul 7, 2014 at 12:37 PM, Gary Gregory <ga...@gmail.com> wrote:
> I see:
> 
> org.apache.logging.log4j.core.filter.CompositeFilter.createFilters(Filter[]):
> 
>     @PluginFactory
>     public static CompositeFilter createFilters(@PluginElement("Filters") final Filter[] filters) {
> 
> Which is clear, but then I see:
> 
>     public static FileAppender createAppender(
>             // @formatter:off
> ...
>             @PluginElement("Filters") final Filter filter,
> ...
> 
> So it seems like one filter elements (not arrays) should be renamed from "Filters" to "Filter".
> 
> That or the discrepancy between the plural name and singular element needs to be in the Javadoc.
> 
> Thoughts?
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory


Re: Config element name confusion

Posted by Gary Gregory <ga...@gmail.com>.
This one would not need to be fixed:
org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender:

    @PluginFactory
    public static RollingFileAppender createAppender(
...
            @PluginElement("Filter") final Filter filter,
...

So we do have some inconsistencies.


Gary


On Mon, Jul 7, 2014 at 12:37 PM, Gary Gregory <ga...@gmail.com>
wrote:

> I see:
>
>
> org.apache.logging.log4j.core.filter.CompositeFilter.createFilters(Filter[]):
>
>     @PluginFactory
>     public static CompositeFilter createFilters(@PluginElement("Filters")
> final Filter[] filters) {
>
> Which is clear, but then I see:
>
>     public static FileAppender createAppender(
>             // @formatter:off
> ...
>             @PluginElement("Filters") final Filter filter,
> ...
>
> So it seems like one filter elements (not arrays) should be renamed from
> "Filters" to "Filter".
>
> That or the discrepancy between the plural name and singular element needs
> to be in the Javadoc.
>
> Thoughts?
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory