private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
public Logger validate() throws IllegalArgumentException { return logContext.getLogger(loggerName); }
/** * Returns a JBoss Log Manger logger. * * @param name the name of the logger. * * @return a logger. */ static org.jboss.logmanager.Logger getJBossLogger(final LogContext logContext, final String name) { final String loggerName = (name == null || name.equals(LOG4J_ROOT_NAME)) ? JBL_ROOT_NAME : name; return logContext.getLogger(loggerName); }
/** * Get or create a logger with the given name. * * @param name the logger name * @return the corresponding logger */ public Logger getLogger(String name) { return LogContext.getLogContext().getLogger(name); }
public LogContextStdioContextSelector(final StdioContext defaultContext) { // Register the STDIO context on the default log context LogContext.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME).attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, defaultContext); }
public Logger getLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(name); final Logger logger = lmLogger.getAttachment(key); if (logger != null) { return logger; } return doPrivileged(new PrivilegedAction<Logger>() { public Logger run() { final Slf4jLogger newLogger = new Slf4jLogger(lmLogger); final Logger appearingLogger = lmLogger.attachIfAbsent(key, newLogger); return appearingLogger != null ? appearingLogger : newLogger; } }); } }
public LogContextStdioContextSelector(final StdioContext defaultContext) { // Register the STDIO context on the default log context LogContext.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME).attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, defaultContext); }
public LogContextStdioContextSelector(final StdioContext defaultContext) { // Register the STDIO context on the default log context LogContext.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME).attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, defaultContext); }
public Logger getLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(name); final Logger logger = lmLogger.getAttachment(reposKey); if (logger != null) { return logger; } return create(lmLogger); }
@Override public StdioContext getStdioContext() { final LogContext logContext = LogContext.getLogContext(); final Logger root = logContext.getLogger(CommonAttributes.ROOT_LOGGER_NAME); StdioContext stdioContext = root.getAttachment(STDIO_CONTEXT_ATTACHMENT_KEY); if (stdioContext == null) { stdioContext = StdioContext.create( new NullInputStream(), new LoggingOutputStream(logContext.getLogger("stdout"), Level.INFO), new LoggingOutputStream(logContext.getLogger("stderr"), Level.ERROR) ); final StdioContext appearing = root.attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, stdioContext); if (appearing != null) { stdioContext = appearing; } } return stdioContext; } }
@Override public StdioContext getStdioContext() { final LogContext logContext = LogContext.getLogContext(); final Logger root = logContext.getLogger(CommonAttributes.ROOT_LOGGER_NAME); StdioContext stdioContext = root.getAttachment(STDIO_CONTEXT_ATTACHMENT_KEY); if (stdioContext == null) { stdioContext = StdioContext.create( new NullInputStream(), new LoggingOutputStream(logContext.getLogger("stdout"), Level.INFO), new LoggingOutputStream(logContext.getLogger("stderr"), Level.ERROR) ); final StdioContext appearing = root.attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, stdioContext); if (appearing != null) { stdioContext = appearing; } } return stdioContext; } }
@Override public StdioContext getStdioContext() { final LogContext logContext = LogContext.getLogContext(); final Logger root = logContext.getLogger(CommonAttributes.ROOT_LOGGER_NAME); StdioContext stdioContext = root.getAttachment(STDIO_CONTEXT_ATTACHMENT_KEY); if (stdioContext == null) { stdioContext = StdioContext.create( new NullInputStream(), new LoggingOutputStream(logContext.getLogger("stdout"), Level.INFO), new LoggingOutputStream(logContext.getLogger("stderr"), Level.ERROR) ); final StdioContext appearing = root.attachIfAbsent(STDIO_CONTEXT_ATTACHMENT_KEY, stdioContext); if (appearing != null) { stdioContext = appearing; } } return stdioContext; } }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
private static Logger doLegacyGetLogger(final String name) { final org.jboss.logmanager.Logger lmLogger = LogContext.getLogContext().getLogger(""); ConcurrentMap<String, Logger> loggers = lmLogger.getAttachment(LEGACY_KEY); if (loggers == null) { loggers = new ConcurrentHashMap<String, Logger>(); final ConcurrentMap<String, Logger> appearing = lmLogger.attachIfAbsent(LEGACY_KEY, loggers); if (appearing != null) { loggers = appearing; } } Logger l = loggers.get(name); if (l != null) { return l; } final org.jboss.logmanager.Logger logger = org.jboss.logmanager.Logger.getLogger(name); l = new JBossLogManagerLogger(name, logger); final Logger appearing = loggers.putIfAbsent(name, l); if (appearing == null) { return l; } return appearing; }
/** * Gets the property configurator. If the {@link ConfigurationPersistence} does not exist a new one is created. * * @param logContext the log context used to find the property configurator or to attach it to. * * @return the property configurator */ public static ConfigurationPersistence getOrCreateConfigurationPersistence(final LogContext logContext) { final Logger root = logContext.getLogger(CommonAttributes.ROOT_LOGGER_NAME); ConfigurationPersistence result = (ConfigurationPersistence) root.getAttachment(Configurator.ATTACHMENT_KEY); if (result == null) { result = new ConfigurationPersistence(logContext); ConfigurationPersistence existing = (ConfigurationPersistence) root.attachIfAbsent(Configurator.ATTACHMENT_KEY, result); if (existing != null) { result = existing; } } return result; }
private LoggingConfigurationUpdater getOrCreateUpdater() { final LogContext logContext = LogContext.getLogContext(); final org.jboss.logmanager.Logger rootLogger = logContext.getLogger(""); LoggingConfigurationUpdater updater = rootLogger.getAttachment(KEY); if (updater == null) { final LogContextConfiguration logContextConfiguration = getOrCreateConfiguration(rootLogger); if (logContextConfiguration == null) { return null; } updater = new LoggingConfigurationUpdater(logContextConfiguration); final LoggingConfigurationUpdater appearing = rootLogger.attachIfAbsent(KEY, updater); if (appearing != null) { updater = appearing; } } return updater; }