public static void configureFrom(final Config config) { Preconditions.checkNotNull(config); final String loggingPath = config.getString(LOGGING_PATH_CONFIG); final Optional<String> logLevel = ConfigModule.firstString(config, LOGGING_CONFIG_ROOT + LOGLEVEL_CONFIG, DEPRECATED_CONFIG_ROOT + LOGLEVEL_CONFIG); final Optional<String> rootLogLevel = ConfigModule.firstString(config, LOGGING_CONFIG_ROOT + ROOT_LOGLEVEL_CONFIG, DEPRECATED_CONFIG_ROOT + ROOT_LOGLEVEL_CONFIG); final boolean resetLoggingContext = !config.getBoolean(TO_CONSOLE_CONFIG); configure( loggingPath, logLevel.orElse("default"), rootLogLevel.orElse("default"), resetLoggingContext); }
private static void configureLogback(final String loggingPath, final LoggerContext lc, final Level logLevel, final Level rootLogLevel) { configureRootLogger(loggingPath, lc, rootLogLevel); configureDswarmLogger(loggingPath, lc, logLevel); configureMonitoringLogger(loggingPath, lc); }
private static Injector getInjector() { final ConfigModule configModule = new ConfigModule(); final Config config = configModule.getConfig(); LoggingConfigurator.configureFrom(config); return Guice.createInjector( configModule, new PersistenceModule(), new JacksonObjectMapperModule(), new JpaHibernateModule(config) ); } }
private static void configure(final String loggingPath, final String logLevel, final String rootLogLevel, final boolean resetLoggingContext) { if (ALREADY_CONFIGURED.getAndSet(true)) { return; } final LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); if (lc.isStarted()) { return; } final StatusManager sm = lc.getStatusManager(); if (sm != null) { sm.add(new InfoStatus("Setting up dswarm configuration.", lc)); } if (resetLoggingContext) { lc.reset(); } final Level level = Level.toLevel(logLevel, Level.INFO); final Level rootLevel = Level.toLevel(rootLogLevel, Level.INFO); configureLogback(loggingPath, lc, level, rootLevel); lc.start(); }
public static Injector getInjector() { final ConfigModule configModule = new ConfigModule(); final Config config = configModule.getConfig(); LoggingConfigurator.configureFrom(config); return Guice.createInjector( configModule, new PersistenceModule(), new JacksonObjectMapperModule(), new JpaHibernateModule(config) ); }
public static Injector getInjector() { final ConfigModule configModule = new ConfigModule(); final Config config = configModule.getConfig(); LoggingConfigurator.configureFrom(config); final JacksonObjectMapperModule objectMapperModule = new JacksonObjectMapperModule() .include(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_EMPTY) .withoutTransformation(); return Guice.createInjector( configModule, objectMapperModule, new PersistenceModule(), new ConverterModule(), new JpaHibernateModule(config) ); }