1 % $Author: Peter Gagarinov, PhD <pgagarinov@gmail.com> $
     2 % $Copyright: 2015-2016 Peter Gagarinov, PhD
     3 %             2012-2015 Moscow State University,
     4 %            Faculty of Applied Mathematics and Computer Science,
     5 %            System Analysis Department$
     6 % Test the ability to change Log4j configuration when
     7 % Log4jConfigurator.configure method is called in 
default mode or with
     8 % confMode=allowConfChange.
     9 % Warning: This script clobbers any existing log4j configuration!
    11 import org.apache.log4j.Level;
    12 confStr = 
'log4j.rootLogger=WARN'; %#ok<NASGU>
    13 evalc(
'Log4jConfigurator.configure(confStr)');
    14 % Create a logger instance
    15 logger=Log4jConfigurator.getLogger();
    16 % Log4j should be configured with WARN level; therefore, INFO level should
    18 if logger.isInfoEnabled()
    19     error(
'Failed to configure Log4j');
    21 confStr = 
'log4j.rootLogger=INFO';
    22 % Try to configure log4j again, 
using INFO level. This time specify the
    24 evalc(
'Log4jConfigurator.configure(confStr,''confMode'',''allowConfChange'')');
    25 if ~logger.isInfoEnabled()
    26     error(
'Failed to change Log4j configuration');
 LOG4JCONFIGURATOR implements the Log4jConfigurator abstract class.