It's supposed to work the same way that MarkerFilter works. Checking if a
message is filtered based on the marker means you can deny or allow events
strictly based on what marker is attached. You can do some pretty cool
stuff with MarkerFilter if you're using markers a lot.

On 29 June 2016 at 12:31, Mikael Ståldal <[email protected]> wrote:

> I have now added unit tests for Logger.isEnabled(Level, Marker) similar to
> those existing for Logger.isEnabled(Level), and fixed the Javadoc.
>
> If we want more elaborate tests, I am a bit unsure about how it supposed
> to work so someone else should do that.
>
> On Wed, Jun 29, 2016 at 5:43 PM, Matt Sicker <[email protected]> wrote:
>
>> There are two options to test that, then:
>>
>> 1. Update TestLogger in log4j-api/test to add support for marker filters.
>> 2. Make a full integration test (i.e., with a config file) for
>> MarkerFilter as the current test only uses the filter directly.
>>
>> On 29 June 2016 at 03:54, Mikael Ståldal <[email protected]>
>> wrote:
>>
>>> There is no unit test coverage of Logger.isEnabled(Level, Marker)
>>>
>>> On Tue, Jun 28, 2016 at 5:52 PM, Gary Gregory <[email protected]>
>>> wrote:
>>>
>>>> On Tue, Jun 28, 2016 at 8:48 AM, Mikael Ståldal <
>>>> [email protected]> wrote:
>>>>
>>>>> The Javadoc for the Logger.isEnabled methods looks a bit odd. I just
>>>>> fixed a few obvious errors, but some questions:
>>>>>
>>>>> - I guess that the note about Level.OFF applies to both of them?
>>>>>
>>>>
>>>> I would guess yes and I hope we have a unit test just for that! ;-) Do
>>>> you mind checking, I am about to go AFK.
>>>>
>>>>
>>>>>
>>>>> - Is the marker optional?
>>>>>
>>>>> - I guess that the marker param should not be formulated like it is?
>>>>>
>>>>
>>>> Kind of hard to explain without explaining markers eh? ;-) But if we
>>>> talk about "checking the level" we should also talk about "checking" the
>>>> marker. In both cases it would be nice to say what we are checking
>>>> _against_!
>>>>
>>>> Gary
>>>>
>>>>>
>>>>> /**
>>>>>  * Checks whether this Logger is enabled for the given Level.
>>>>>  * <p>
>>>>>  * Note that passing in {@link Level#OFF OFF} always returns {@code true}.
>>>>>  * </p>
>>>>>  *
>>>>>  * @param level the Level to check
>>>>>  * @return boolean - {@code true} if this Logger is enabled for level, 
>>>>> {@code false} otherwise.
>>>>>  */
>>>>> boolean isEnabled(Level level);
>>>>>
>>>>> /**
>>>>>  * Checks whether this Logger is enabled for the given Level and an 
>>>>> optional Marker.
>>>>>  *
>>>>>  * @param level The Level to check
>>>>>  * @param marker The marker data specific to this log statement.
>>>>>  * @return boolean - {@code true} if this Logger is enabled for level and 
>>>>> marker, {@code false} otherwise.
>>>>>  */
>>>>> boolean isEnabled(Level level, Marker marker);
>>>>>
>>>>>
>>>>> --
>>>>> [image: MagineTV]
>>>>>
>>>>> *Mikael Ståldal*
>>>>> Senior software developer
>>>>>
>>>>> *Magine TV*
>>>>> [email protected]
>>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>>
>>>>> Privileged and/or Confidential Information may be contained in this
>>>>> message. If you are not the addressee indicated in this message
>>>>> (or responsible for delivery of the message to such a person), you may
>>>>> not copy or deliver this message to anyone. In such case,
>>>>> you should destroy this message and kindly notify the sender by reply
>>>>> email.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: [email protected] | [email protected]
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> [image: MagineTV]
>>>
>>> *Mikael Ståldal*
>>> Senior software developer
>>>
>>> *Magine TV*
>>> [email protected]
>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>
>>> Privileged and/or Confidential Information may be contained in this
>>> message. If you are not the addressee indicated in this message
>>> (or responsible for delivery of the message to such a person), you may
>>> not copy or deliver this message to anyone. In such case,
>>> you should destroy this message and kindly notify the sender by reply
>>> email.
>>>
>>
>>
>>
>> --
>> Matt Sicker <[email protected]>
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> [email protected]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



-- 
Matt Sicker <[email protected]>

Reply via email to