Code example for LogRecord

Methods: getLevel, getMessage, getParameters, getResourceBundle, getThrown

0
    lal.log(null, FQCN, slf4jLevel, i18nMessage, record.getThrown());
  } 
 
  protected void callPlainSLF4JLogger(Logger slf4jLogger, LogRecord record) {
    String i18nMessage = getMessageI18N(record);
    int julLevelValue = record.getLevel().intValue();
    if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
      slf4jLogger.trace(i18nMessage, record.getThrown());
    } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
      slf4jLogger.debug(i18nMessage, record.getThrown());
    } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
      slf4jLogger.info(i18nMessage, record.getThrown());
    } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
      slf4jLogger.warn(i18nMessage, record.getThrown());
    } else { 
      slf4jLogger.error(i18nMessage, record.getThrown());
    } 
  } 
 
  /** 
   * Get the record's message, possibly via a resource bundle. 
   *  
   * @param record 
   * @return 
   */ 
  private String getMessageI18N(LogRecord record) {
    String message = record.getMessage();
 
    if (message == null) {
      return null; 
    } 
 
    ResourceBundle bundle = record.getResourceBundle();
    if (bundle != null) {
      try { 
        message = bundle.getString(message);
      } catch (MissingResourceException e) {
      } 
    } 
    Object[] params = record.getParameters();
    if (params != null) {
      message = MessageFormat.format(message, params);
    } 
    return message;
  }