@Test
public void testLoggerLevels()
{

  org.slf4j.Logger sl4jLogger;
  org.apache.log4j.Logger log4jLogger;
  Map<String, String> changes = Maps.newHashMap();
  changes.put("_.org.apache.*", "WARN");
  changes.put("_.com.datatorrent.*", "WARN");
  changes.put("_.com.datatorrent.stram.client.*", "INFO");
  changes.put("_.com.datatorrent.stram.api.*", "DEBUG");
  LoggerUtil.changeLoggersLevel(changes);
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.client.DTConfiguration");
  assertTrue(sl4jLogger.isInfoEnabled());
  assertFalse(sl4jLogger.isDebugEnabled());
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.api.StramEvent");
  assertTrue(sl4jLogger.isInfoEnabled());
  assertTrue(sl4jLogger.isDebugEnabled());
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.StreamingAppMaster");
  assertFalse(sl4jLogger.isInfoEnabled());
  assertFalse(sl4jLogger.isDebugEnabled());
  log4jLogger = LogManager.getLogger("_.com.datatorrent.stram.client.DTConfiguration");
  assertSame(log4jLogger.getLevel(), Level.INFO);
  assertSame(log4jLogger.getEffectiveLevel(), Level.INFO);
  org.apache.log4j.Logger stramEventLogger = LogManager.getLogger("_.com.datatorrent.stram.api.StramEvent");
  assertSame(stramEventLogger.getLevel(), Level.DEBUG);
  assertSame(stramEventLogger.getEffectiveLevel(), Level.DEBUG);
  org.apache.log4j.Logger streamingAppMasterLogger = LogManager.getLogger("_.com.datatorrent.stram.StreamingAppMaster");
  assertSame(streamingAppMasterLogger.getLevel(), Level.WARN);
  assertSame(streamingAppMasterLogger.getEffectiveLevel(), Level.WARN);
  changes.clear();
  changes.put("_.com.datatorrent.*", "DEBUG");
  changes.put("_.com.datatorrent.stram.engine.*", "ERROR");
  LoggerUtil.changeLoggersLevel(changes);
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.client.DTConfiguration");
  assertTrue(sl4jLogger.isInfoEnabled());
  assertTrue(sl4jLogger.isDebugEnabled());
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.api.StramEvent");
  assertTrue(sl4jLogger.isInfoEnabled());
  assertTrue(sl4jLogger.isDebugEnabled());
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.StreamingAppMaster");
  assertTrue(sl4jLogger.isInfoEnabled());
  assertTrue(sl4jLogger.isDebugEnabled());
  sl4jLogger = LoggerFactory.getLogger("_.com.datatorrent.stram.engine.StreamingContainer");
  assertFalse(sl4jLogger.isInfoEnabled());
  assertFalse(sl4jLogger.isDebugEnabled());
  log4jLogger = LogManager.getLogger("_.com.datatorrent.stram.client.DTConfiguration");
  assertSame(log4jLogger.getLevel(), Level.DEBUG);
  assertSame(log4jLogger.getEffectiveLevel(), Level.DEBUG);
  log4jLogger = LogManager.getLogger("_.com.datatorrent.stram.api.StramEvent");
  assertSame(log4jLogger.getLevel(), Level.DEBUG);
  assertSame(log4jLogger.getEffectiveLevel(), Level.DEBUG);
  log4jLogger = LogManager.getLogger("_.com.datatorrent.stram.StreamingAppMaster");
  assertSame(log4jLogger.getLevel(), Level.DEBUG);
  assertSame(log4jLogger.getEffectiveLevel(), Level.DEBUG);
  log4jLogger = LogManager.getLogger("_.com.datatorrent.stram.engine.StreamingContainer");
  assertSame(log4jLogger.getLevel(), Level.ERROR);
  assertSame(log4jLogger.getEffectiveLevel(), Level.ERROR);
}