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

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

NOTE: We can't commit any changes along these lines until SOLR-15697 
generalizes {{SolrTestCaseJ4.ignoreException}}

----

Here are some perl one liners that (when executed in order) get us most of the 
way forwards with this change -- but still leave some "two arg" calls to 
{{SolrException.log(log, foo)}} in place (which may be log messages or 
Throwables and need handled differently accordingly)

And as noted in the description: many calls "fixed" by this perl logic still 
need manual cleanup to pass our logging validation..

{noformat}
find -name \*.java | xargs perl -i -pe 
's{SolrException.log\(\s*([^,]+?)\s*,\s*"",\s*([^,)]+?)\s*\)}{$1.error($2.toString(),
 $2)}'

find -name \*.java | xargs perl -i -pe 
's{SolrException.log\(\s*([^,]+?)\s*,\s*}{$1.error(}'
{noformat}


> replace all SolrException.log usage in Solr to just call log.error(...) 
> directly
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-15703
>                 URL: https://issues.apache.org/jira/browse/SOLR-15703
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Chris M. Hostetter
>            Assignee: Chris M. Hostetter
>            Priority: Major
>
> There is a lot of code in Solr that uses {{SolrException.log(log, ..)}} as a 
> way to ensure that the resulting exception can be "ignored" in tests via 
> {{SolrException.ignorePatterns}} / {{SolrTestCaseJ4.ignoreException()}}
> This "test feature" is being cleaned up / replaced in SOLR-15697 so that 
> _any_ log message can be "muted" - meaning we don't need this special 
> hook/hack – we can replace all calls to {{SolrException.log(log, ..)}} with 
> (more efficient) direct calls to {{log.error(..)}} 
> But this change isn't trivially to do in a scripted/automated manner – 
> notably many of these {{SolrException.log(log, ..)}} use string concatenation 
> that needs to be replaced with logging parameterization to pass our 
> {{validateLogCalls}} check.



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

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

Reply via email to