use of com.torodb.packaging.config.model.generic.LogLevel in project torodb by torodb.
the class Log4jUtils method setLevel.
private static void setLevel(Logger logger, LogLevel logLevel) {
Level log4jLevel = Log4jLevelToLogLevelMapper.map(logLevel);
logger.setLevel(log4jLevel);
}
use of com.torodb.packaging.config.model.generic.LogLevel in project torodb by torodb.
the class Log4jUtils method setLevel.
private static void setLevel(LoggerConfig loggerConfig, LogLevel logLevel) {
Level log4jLevel = Log4jLevelToLogLevelMapper.map(logLevel);
loggerConfig.setLevel(log4jLevel);
}
use of com.torodb.packaging.config.model.generic.LogLevel in project torodb by torodb.
the class Log4jUtils method setLogPackages.
public static void setLogPackages(Map<String, LogLevel> logPackages) {
for (Map.Entry<String, LogLevel> logPackage : logPackages.entrySet()) {
LoggerContext coreContext = (LoggerContext) LogManager.getContext(false);
Logger logger = coreContext.getLogger(logPackage.getKey());
setLevel(logger, logPackage.getValue());
}
}
use of com.torodb.packaging.config.model.generic.LogLevel in project torodb by torodb.
the class ConfigTest method testParseWithLogPackagesParam.
@Test
public void testParseWithLogPackagesParam() throws Exception {
final String logPackage = "com.torodb";
final LogLevel level = LogLevel.NONE;
CliConfig cliConfig = new CliConfig() {
@Override
public List<String> getParams() {
String[] params = new String[] { "/logging/packages/" + logPackage + "=" + level.name() };
return Arrays.asList(params);
}
};
Config config = CliConfigUtils.readConfig(cliConfig);
Assert.assertTrue("/logging/packages not defined", config.getLogging().getPackages() != null);
Assert.assertTrue("/logging/packages/" + logPackage + " not defined", config.getLogging().getPackages().get(logPackage) != null);
Assert.assertEquals("/logging/packages has not 1 entry", 1, config.getLogging().getPackages().size());
Assert.assertEquals("/logging/packages/" + logPackage + " has different value than that specified", level, config.getLogging().getPackages().get(logPackage));
}
use of com.torodb.packaging.config.model.generic.LogLevel in project torodb by torodb.
the class ConfigTest method testParseWithLogPackagesParam.
@Test
public void testParseWithLogPackagesParam() throws Exception {
final String logPackage = "com.torodb";
final LogLevel logLevel = LogLevel.NONE;
CliConfig cliConfig = new CliConfig() {
@Override
public List<String> getParams() {
String[] params = new String[] { "/generic/logPackages/" + logPackage + "=" + logLevel.name() };
return Arrays.asList(params);
}
};
Config config = CliConfigUtils.readConfig(cliConfig);
Assert.assertTrue("/generic/logPackages not defined", config.getGeneric().getLogPackages() != null);
Assert.assertTrue("/generic/logPackages/" + logPackage + " not defined", config.getGeneric().getLogPackages().get(logPackage) != null);
Assert.assertEquals("/generic/logPackages has not 1 entry", 1, config.getGeneric().getLogPackages().size());
Assert.assertEquals("/generic/logPackages/" + logPackage + " has different value than that specified", logLevel, config.getGeneric().getLogPackages().get(logPackage));
}
Aggregations