@Override public Logger compute(final Object[] args) throws InterruptedException { final LogCategory category = (LogCategory) args[0]; final LogStream logStream = logStreamFactory.createLogStream(category); final String baseName = (String) args[1]; return new Logger(category, logStream, baseName); } };
public Logger compute(Object[] args) throws InterruptedException { LogCategory category = (LogCategory) args[0]; LogStream logStream = logStreamFactory.createLogStream(category); String baseName = (String) args[1]; Logger logger = new Logger(category, logStream, baseName); return logger; } };
@Override public Logger compute(final LoggerKey args) throws InterruptedException { return new Logger(args.category, logStreamFactory.createLogStream(args.category), args.baseName); } };
@Override public Logger compute(final LoggerKey args) throws InterruptedException { return new Logger(args.category, logStreamFactory.createLogStream(args.category), args.baseName); } };
/** * Finds a Logger from the cache and returns it. If not found in cache then builds a Logger and returns it. * * @param category - The category of the logger * @param baseName - The baseName for the ResourceBundle * @return Logger */ public static Logger getInstance(LogCategory category, String baseName) { try { Logger logger = loggerCache.compute(new Object[]{category, baseName}); return logger; } catch (InterruptedException e) { // Don't return null here. Just create a new Logger and set it up. // It will not be stored in the cache, but a later lookup for the // same Logger would probably end up in the cache LogStream logStream = logStreamFactory.createLogStream(category); Logger logger = new Logger(category, logStream, baseName); return logger; } }
private static void checkForIgnoredLog4jConfig() { if (logStreamFactory.getClass().getName().equals("org.apache.openejb.util.Log4jLogStreamFactory")) { return; } try { final Properties configFile = log4j(loadLoggingProperties()); final Properties systemProperties = log4j(SystemInstance.get().getProperties()); if (configFile.size() == 0 && systemProperties.size() == 0) { return; } if (systemProperties.size() == 1 && "log4j.configurationFile".equals(systemProperties.stringPropertyNames().iterator().next())) { // not a logger config but the overall config // since log4j2 uses it too we can't pollute logs with warnings there for that only return; } final LogStream stream = logStreamFactory.createLogStream(LogCategory.OPENEJB); stream.warn("Log4j not installed. The following properties will be ignored."); final String format = "Ignored %s property '%s'"; for (final Object key : configFile.keySet()) { stream.warn(String.format(format, "conf/logging.properties", key)); } for (final Object key : systemProperties.keySet()) { stream.warn(String.format(format, "Property overrides", key)); } } catch (final Throwable e) { // added strong catch block just in case // This check is only a convenience } }
private static void checkForIgnoredLog4jConfig() { if (logStreamFactory.getClass().getName().equals("org.apache.openejb.util.Log4jLogStreamFactory")) { return; } try { final Properties configFile = log4j(loadLoggingProperties()); final Properties systemProperties = log4j(SystemInstance.get().getProperties()); if (configFile.size() == 0 && systemProperties.size() == 0) { return; } final LogStream stream = logStreamFactory.createLogStream(LogCategory.OPENEJB); stream.warn("Log4j not installed. The following properties will be ignored."); final String format = "Ignored %s property '%s'"; for (final Object key : configFile.keySet()) { stream.warn(String.format(format, "conf/logging.properties", key)); } for (final Object key : systemProperties.keySet()) { stream.warn(String.format(format, "Property overrides", key)); } } catch (final Throwable e) { // added strong catch block just in case // This check is only a convenience } }
private static void checkForIgnoredLog4jConfig() { if (logStreamFactory.getClass().getName().equals("org.apache.openejb.util.Log4jLogStreamFactory")) { return; } try { final Properties configFile = log4j(loadLoggingProperties()); final Properties systemProperties = log4j(SystemInstance.get().getProperties()); if (configFile.size() == 0 && systemProperties.size() == 0) { return; } final LogStream stream = logStreamFactory.createLogStream(LogCategories.TRIBESTREAM); stream.warn("Log4j not installed. The following properties will be ignored."); final String format = "Ignored %s property '%s'"; for (final Object key : configFile.keySet()) { stream.warn(String.format(format, "conf/logging.properties", key)); } for (final Object key : systemProperties.keySet()) { stream.warn(String.format(format, "Property overrides", key)); } } catch (final Throwable e) { // added strong catch block just in case // This check is only a convenience } }
/** * Finds a Logger from the cache and returns it. If not found in cache then builds a Logger and returns it. * * @param category - The category of the logger * @param baseName - The baseName for the ResourceBundle * @return Logger */ public static Logger getInstance(final LogCategory category, final String baseName) { configure(); try { return loggerCache.compute(new Object[]{category, baseName}); } catch (final InterruptedException e) { // Don't return null here. Just create a new Logger and set it up. // It will not be stored in the cache, but a later lookup for the // same Logger would probably end up in the cache final LogStream logStream = logStreamFactory.createLogStream(category); return new Logger(category, logStream, baseName); } }
/** * Finds a Logger from the cache and returns it. If not found in cache then builds a Logger and returns it. * * @param category - The category of the logger * @param baseName - The baseName for the ResourceBundle * @return Logger */ public static Logger getInstance(final LogCategory category, final String baseName) { configure(); try { return loggerCache.compute(new LoggerKey(category, baseName)); } catch (final InterruptedException e) { // Don't return null here. Just create a new Logger and set it up. // It will not be stored in the cache, but a later lookup for the // same Logger would probably end up in the cache final LogStream logStream = logStreamFactory.createLogStream(category); return new Logger(category, logStream, baseName); } }
/** * Finds a Logger from the cache and returns it. If not found in cache then builds a Logger and returns it. * * @param category - The category of the logger * @param baseName - The baseName for the ResourceBundle * @return Logger */ public static Logger getInstance(final LogCategory category, final String baseName) { configure(); try { return LOGGER_CACHE.compute(new LoggerKey(category, baseName)); } catch (final InterruptedException e) { // Don't return null here. Just create a new Logger and set it up. // It will not be stored in the cache, but a later lookup for the // same Logger would probably end up in the cache final LogStream logStream = logStreamFactory.createLogStream(category); return new Logger(category, logStream, baseName); } }