/** * @see * alma.acs.logging.config.LogConfigSubscriber#configureLogging(alma.acs.logging.config.LogConfig) */ public void configureLogging(LogConfig newLogConfig) { // just in case some day LogConfig is no longer used as a singleton this.logConfig = newLogConfig; try { AcsLogLevelDefinition minLogLevelACS = AcsLogLevelDefinition.fromXsdLogLevel( logConfig.getNamedLoggerConfig(loggerName).getMinLogLevelLocal()); setLevel(AcsLogLevel.getLowestMatchingJdkLevel(minLogLevelACS)); } catch (Exception ex) { publish( new LogRecord(Level.WARNING, "Failed to configure stdout log handler: " + ex.toString())); } }
public static synchronized LocalOnlyAcsLogger getInstance(String namespace, Level level) { if (instance == null) { LogConfig testLogConfig = new LogConfig(); testLogConfig.setDefaultMinLogLevelLocal(AcsLogLevel.getNativeLevel(level).getAcsLevel()); instance = new LocalOnlyAcsLogger(namespace, testLogConfig); instance.setUseParentHandlers(false); Handler logHandler = new StdOutConsoleHandler(testLogConfig, namespace, null); logHandler.setFormatter( new AcsXMLLogFormatter() { public String format(LogRecord lr) { String xml = super.format(lr); return xml + '\n'; } }); logHandler.setLevel(level); instance.addHandler(logHandler); } return instance; }