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);
}
}
Aggregations