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 "Henry Clout (JIRA)" <ji...@apache.org> on 2013/04/15 16:54:15 UTC
[jira] [Comment Edited] (LOG4J2-173) BurstFilter does not honour
level
[ https://issues.apache.org/jira/browse/LOG4J2-173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631745#comment-13631745 ]
Henry Clout edited comment on LOG4J2-173 at 4/15/13 2:53 PM:
-------------------------------------------------------------
It looks like the test which checks that level filtering is working correctly is being hampered by throttling occurring from a previous test. Modifying the test with a sleep causes the level checking test to fail :
BurstFilterTest.java
...
103: assertTrue("", filter.getAvailable() == 0);
104: app.clear();
105:
106: // !!! Added by HC: wait for throttling to clear ...
107: Thread.sleep(3100);
108:
109: // now log 100 debugs, they shouldn't get through because there are no available slots.
110: for (int i = 0; i < 110; i++) {
111: logger.debug(
112: "TEST FAILED! Logging 110 debug messages, shouldn't see any of them because they are debugs #" + (i + 1));
113: }
...
This now consistently fails when I run the test. I'll attach the modified source.
was (Author: bighenry):
It looks like the test which checks that level filtering is working correctly is being hampered by throttling occurring from a previous test. Modifying the test with a sleep causes the level checking test to fail :
BurstFilterTest.java
...
103: assertTrue("", filter.getAvailable() == 0);
104: app.clear();
105:
106: // !!! Added by HC: wait for throttling to clear ...
107: Thread.sleep(4000);
108:
109: // now log 100 debugs, they shouldn't get through because there are no available slots.
110: for (int i = 0; i < 110; i++) {
111: logger.debug(
112: "TEST FAILED! Logging 110 debug messages, shouldn't see any of them because they are debugs #" + (i + 1));
113: }
...
This now consistently fails when I run the test. I'll attach the modified source.
> BurstFilter does not honour level
> ---------------------------------
>
> Key: LOG4J2-173
> URL: https://issues.apache.org/jira/browse/LOG4J2-173
> Project: Log4j 2
> Issue Type: Bug
> Components: Filters
> Affects Versions: 2.0-beta4
> Reporter: Henry Clout
> Attachments: BurstFilterTest.java
>
>
> I've been getting info (and below) logging out of the BurstFilter despite it being set to warn. The problem seems to be in the filter method, the test :
> if (this.level.isAtLeastAsSpecificAs(level)) {
> ... seems to be the wrong way around.
> I changed the method locally to be:
> private Result filter(final Level level) {
> if (level.isAtLeastAsSpecificAs(this.level)) {
> LogDelay delay = history.poll();
> while (delay != null) {
> available.add(delay);
> delay = history.poll();
> }
> delay = available.poll();
> if (delay != null) {
> delay.setDelay(burstInterval);
> history.add(delay);
> return onMatch;
> }
> return onMismatch;
> }
> return onMismatch;
> }
> Which seems to have the desired results.
> Does this make sense?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org