java - Any tool to annotate a method so that method do not produce logs -


i have junit tests. in tests test cases goes exception blocks in testing method. , logs errors, ends in junit test results. can slf4j configuration , omit whole class logging. wish can annotate test method , ever code runs not produce logs.

(a) can use 2 loggers, default class , 1 method-specific in method:

private static final logger log = loggerfactory.getlogger(yourservice.class); private static final logger customlog = loggerfactory.getlogger(yourservice.class.getcanonicalname() + "#yourmethod"); 

(b) or can adjust logging system in test setup/teardown:

@setup public void setup() {     logger log = loggerfactory.getlogger(yourservice.class);     ((loggerimlpementationclass) log).setloglevel(...); } // same, reset, in tear down method. 

however in case required change logger dependency scope runtime test (in maven terms).


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -