logging - How to get "max" attribute value of DefaultRolloverStrategy in log4j2 in Java -


i have 1 concern in log4j2. in below appender definition, default rollover strategy employed shown below:

 <defaultrolloverstrategy max="5" /> 

i need access value of max in java customizations. please me how value can retrieved. can appender logger not aware how max value of defaultrolloverstrategy defined within appender.

<rollingfile name="test_file" filename="${sys:logs}/test.log" filepattern="${sys:logs}/test.log.%i" append="true">         <patternlayout>             <pattern>%d %-5p [%c{1}] [customdata: %data] [%t] %m%n</pattern>         </patternlayout>         <policies>             <sizebasedtriggeringpolicy size="500 kb" />         </policies>         <defaultrolloverstrategy max="5" />         <filters>             <thresholdfilter level="debug"/>                 <thresholdfilter level="off" onmatch="deny" onmismatch="neutral"/>                       </filters>           

please me. thanks.

i have achieved using below code snippet.

int maxbackupindex = ((defaultrolloverstrategy)((rollingfileappender) app).getmanager().getrolloverstrategy()).getmaxindex();


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -