/** * Get an instance of LogFormatter. * * @return an instance of LogFormatter */ public static LogFormatter getInstance() { if (logFormatter == null) { String logFormatterImplementation = SystemConfigProvider.getInstance().getStringProperty( SYSTEM_CONFIG.getPackageVariableName(LOG_FORMATTER_IMPLEMENTATION_SETTING_NAME), DEFAULT_LOG_FORMATTER_IMPL ); try { logFormatter = (LogFormatter) Class.forName(logFormatterImplementation).newInstance(); } catch (Exception exception) { LOG.error("Exception while loading Log formatter: {}", exception); throw new IllegalStateException(exception); } } return logFormatter; } }
/** * Returns whether the feature flag has been configured. * * @return true if the feature flag has been configured. */ default boolean isSet() { SystemConfig systemConfig = SystemConfigProvider.getInstance(); try { return systemConfig.getStringProperty(systemConfig.getPackageVariableName(getName())) != null; } catch (SystemConfigException exception) { return false; } }