Search in sources :

Example 1 with StartupLoggingConfig

use of io.druid.server.log.StartupLoggingConfig in project druid by druid-io.

the class GuiceRunnable method initLifecycle.

public Lifecycle initLifecycle(Injector injector) {
    try {
        LogLevelAdjuster.register();
        final Lifecycle lifecycle = injector.getInstance(Lifecycle.class);
        final StartupLoggingConfig startupLoggingConfig = injector.getInstance(StartupLoggingConfig.class);
        log.info("Starting up with processors[%,d], memory[%,d].", Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().totalMemory());
        if (startupLoggingConfig.isLogProperties()) {
            final Set<String> maskProperties = Sets.newHashSet(startupLoggingConfig.getMaskProperties());
            final Properties props = injector.getInstance(Properties.class);
            for (String propertyName : Ordering.natural().sortedCopy(props.stringPropertyNames())) {
                String property = props.getProperty(propertyName);
                for (String masked : maskProperties) {
                    if (propertyName.contains(masked)) {
                        property = "<masked>";
                        break;
                    }
                }
                log.info("* %s: %s", propertyName, property);
            }
        }
        try {
            lifecycle.start();
        } catch (Throwable t) {
            log.error(t, "Error when starting up.  Failing.");
            System.exit(1);
        }
        return lifecycle;
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : StartupLoggingConfig(io.druid.server.log.StartupLoggingConfig) Lifecycle(io.druid.java.util.common.lifecycle.Lifecycle) Properties(java.util.Properties)

Aggregations

Lifecycle (io.druid.java.util.common.lifecycle.Lifecycle)1 StartupLoggingConfig (io.druid.server.log.StartupLoggingConfig)1 Properties (java.util.Properties)1