[ 
https://issues.apache.org/jira/browse/SOLR-14099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16999350#comment-16999350
 ] 

Chris M. Hostetter commented on SOLR-14099:
-------------------------------------------

{quote}... shouldn't this be moved into BeforeClass block?
{quote}
As the test is written write now it could be – but then it would run _after_ 
the logic in {{@BeforeClass}} methods of superclasses – like {{SolrTestCaseJ4}} 
where a {{@BeforeClass}} method parses & executres the {{@LogLevel}} annotation 
on this test class and mucks with the Loggers

By making this static final i was trying to avoid that and capture the original 
default logging level as early as possible, before there is any chance that the 
{{LogLevel}} annotation logic invoked by {{SolrTestCaseJ4}} ... ie: exactly 
your point about it only being invoked once per JVM, ... that's what i wanted.

An earlier iteration of this test that i never shared was trying to capture the 
"DEFAULT" levels of multiple packages before the annotation was run, and ran 
into that exact problem – hence I used {{static final}} vars. The current test 
only cares about capture the DEFAULT level of the "root" logger so it's less of 
an issue because the LogLevel annotation doesn't _intentionally_ muck with the 
root logger, but it still seemed prudent not to do this in a {{@BeforeClass}} 
to prevent any risk of "contamination" if the Annotation logic is ever broken 
in the future so that it _unintentinally_ changes the root logger.

make sense?

> @LogLevel annotation not properly reseting after end of test (causes 
> LoggingHandlerTest.testLogLevelHandlerOutput failures)
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-14099
>                 URL: https://issues.apache.org/jira/browse/SOLR-14099
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Chris M. Hostetter
>            Assignee: Chris M. Hostetter
>            Priority: Major
>             Fix For: master (9.0), 8.5
>
>         Attachments: SOLR-14099.patch, SOLR-14099.patch, 
> SOLR-14099_test_workaround.patch
>
>
> We've seen a recent uptick in jenkins failures from 
> {{LoggingHandlerTest.testLogLevelHandlerOutput}} that indicate the @LogLevel 
> usage in other tests that have run earlier in the same JVM are _NOT_ properly 
> being reset when those tests complete.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to