public ResourceBundle getResourceBundle() { return logger.getResourceBundle(); }
private void log(java.util.logging.Level level, Object message, Throwable exception) { if (this.logger.isLoggable(level)) { LogRecord rec; if (message instanceof LogRecord) { rec = (LogRecord) message; } else { rec = new LocationResolvingLogRecord(level, String.valueOf(message)); rec.setLoggerName(this.name); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); rec.setThrown(exception); } logger.log(rec); } }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } catch (Throwable ignored) {} }
public ResourceBundle getResourceBundle() { return logger.getResourceBundle(); }
protected void doLogf(final Level level, final String loggerClassName, String format, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final ResourceBundle resourceBundle = logger.getResourceBundle(); if (resourceBundle != null) try { format = resourceBundle.getString(format); } catch (MissingResourceException e) { // ignore } final String msg = parameters == null ? String.format(format) : String.format(format, parameters); final JBossLogRecord rec = new JBossLogRecord(translate(level), msg, loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setResourceBundleName(logger.getResourceBundleName()); // we've done all the business rec.setResourceBundle(null); rec.setParameters(null); logger.log(rec); } catch (Throwable ignored) {} }
/** * Constructor. * * @param key the message catalog (resource bundle) key * @param logger a logger with an associated resource bundle * @param params the message substitution parameters */ public Message(String key, Logger logger, Object...params) { this(key, logger.getResourceBundle(), params); }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } catch (Throwable ignored) {} }
/** * Constructor. * * @param key the message catalog (resource bundle) key * @param logger a logger with an associated resource bundle * @param params the message substitution parameters */ public Message(String key, Logger logger, Object...params) { this(key, logger.getResourceBundle(), params); }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } }
/** * Constructor. * * @param key the message catalog (resource bundle) key * @param logger a logger with an associated resource bundle * @param params the message substitution parameters */ public Message(String key, Logger logger, Object...params) { this(key, logger.getResourceBundle(), params); }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } catch (Throwable ignored) {} }
/** * Retreive localized message retreived from a logger's resource * bundle. * * @param logger the Logger * @param message the message to be localized */ private static String localize(Logger logger, String message) { ResourceBundle bundle = logger.getResourceBundle(); return bundle != null ? bundle.getString(message) : message; }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } catch (Throwable ignored) {} }
/** *Looks up the key in the logger's resource bundle and substitutes any *arguments provided into the looked-up string. *@param key the key to look up in the resource bundle *@param args optional arguments to plug into the string found in the bundle *@return the formatted string */ private static String formatMsg(String key, Object... args) { String fmt = _logger.getResourceBundle().getString(key); return MessageFormat.format(fmt, args); }
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { if (isEnabled(level)) try { final JBossLogRecord rec = new JBossLogRecord(translate(level), String.valueOf(message), loggerClassName); if (thrown != null) rec.setThrown(thrown); rec.setLoggerName(getName()); rec.setParameters(parameters); rec.setResourceBundleName(logger.getResourceBundleName()); rec.setResourceBundle(logger.getResourceBundle()); logger.log(rec); } catch (Throwable ignored) {} }
private String getLangCode() { String code = LOG.getResourceBundle().getLocale().getLanguage(); if (StringUtils.isEmpty(code)) { return "en"; } return code; }
/** *Returns a formatted string, using the key to find the full message and *substituting any parameters. *@param key the message key with which to locate the message of interest *@param o the object(s), if any, to be substituted into the message *@return a String containing the formatted message */ private static String getMessage(String key, Object... o) { String msg = getLogger().getResourceBundle().getString(key); return MessageFormat.format(msg, o); } }
public Calendar parseDate(String value) { XSDDateFormat format = new XSDDateFormat(); ParsePosition pos = new ParsePosition(0); Calendar cal = (Calendar) format.parseObject(value, pos); if (cal == null) { String message = logger.getResourceBundle().getString("BadDate"); message = message.replace("{0}", value); message = message.replace("{1}", value.substring(pos.getErrorIndex())); throw new IllegalArgumentException(message); } return cal; }
public Calendar parseDate(String value) { XSDDateFormat format = new XSDDateFormat(); ParsePosition pos = new ParsePosition(0); Calendar cal = (Calendar) format.parseObject(value, pos); if (cal == null) { String message = logger.getResourceBundle().getString("BadDate"); message = message.replace("{0}", value); message = message.replace("{1}", value.substring(pos.getErrorIndex())); throw new IllegalArgumentException(message); } return cal; }
private FacesContextFactory acquireFacesContextFactory() throws UnavailableException { try { return (FacesContextFactory) FactoryFinder.getFactory(FACES_CONTEXT_FACTORY); } catch (FacesException e) { String msg = LOGGER.getResourceBundle().getString("severe.webapp.facesservlet.init_failed"); LOGGER.log(SEVERE, msg, e.getCause() != null ? e.getCause() : e); throw new UnavailableException(msg); } }