Java Code Examples for org.slf4j.spi.LocationAwareLogger#WARN_INT

The following examples show how to use org.slf4j.spi.LocationAwareLogger#WARN_INT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Log4jLoggerAdapter.java    From HttpSessionReplacer with MIT License 6 votes vote down vote up
@Override
public void log(Marker marker, String callerFQCN, int level, String msg, Object[] argArray, Throwable t) {
    Level log4jLevel;
    switch (level) {
    case LocationAwareLogger.TRACE_INT:
        log4jLevel = traceCapable ? Level.TRACE : Level.DEBUG;
        break;
    case LocationAwareLogger.DEBUG_INT:
        log4jLevel = Level.DEBUG;
        break;
    case LocationAwareLogger.INFO_INT:
        log4jLevel = Level.INFO;
        break;
    case LocationAwareLogger.WARN_INT:
        log4jLevel = Level.WARN;
        break;
    case LocationAwareLogger.ERROR_INT:
        log4jLevel = Level.ERROR;
        break;
    default:
        throw new IllegalStateException("Level number " + level + " is not recognized.");
    }
    logger.log(callerFQCN, log4jLevel, msg, t);
}
 
Example 2
Source File: SLF4JLogger.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private int convertLevel(final Level level) {
    switch (level.getStandardLevel()) {
        case DEBUG :
            return LocationAwareLogger.DEBUG_INT;
        case TRACE :
            return LocationAwareLogger.TRACE_INT;
        case INFO :
            return LocationAwareLogger.INFO_INT;
        case WARN :
            return LocationAwareLogger.WARN_INT;
        case ERROR :
            return LocationAwareLogger.ERROR_INT;
        default :
            return LocationAwareLogger.ERROR_INT;
    }
}
 
Example 3
Source File: JDK14LoggerAdapter.java    From HttpSessionReplacer with MIT License 6 votes vote down vote up
private Level slf4jLevelIntToJULLevel(int slf4jLevelInt) {
    Level julLevel;
    switch (slf4jLevelInt) {
    case LocationAwareLogger.TRACE_INT:
        julLevel = Level.FINEST;
        break;
    case LocationAwareLogger.DEBUG_INT:
        julLevel = Level.FINE;
        break;
    case LocationAwareLogger.INFO_INT:
        julLevel = Level.INFO;
        break;
    case LocationAwareLogger.WARN_INT:
        julLevel = Level.WARNING;
        break;
    case LocationAwareLogger.ERROR_INT:
        julLevel = Level.SEVERE;
        break;
    default:
        throw new IllegalStateException("Level number " + slf4jLevelInt + " is not recognized.");
    }
    return julLevel;
}
 
Example 4
Source File: Slf4jLogger_impl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
public static int getSlf4jLevel(Level level) {
  switch(level.toInteger()) {
  case Level.SEVERE_INT: return LocationAwareLogger.ERROR_INT;
  case Level.WARNING_INT: return LocationAwareLogger.WARN_INT;
  case Level.INFO_INT: return LocationAwareLogger.INFO_INT;
  case Level.CONFIG_INT: return LocationAwareLogger.INFO_INT;
  case Level.FINE_INT: return LocationAwareLogger.DEBUG_INT;
  case Level.FINER_INT: return LocationAwareLogger.TRACE_INT;
  case Level.FINEST_INT: return LocationAwareLogger.TRACE_INT;
  }
  Misc.internalError();
  return LocationAwareLogger.ERROR_INT; //ignored, just here for compile error avoidance
}
 
Example 5
Source File: ProxyConnectionLogger.java    From g4proxy with Apache License 2.0 5 votes vote down vote up
@Override
public void doLog(int level, String message, Object[] params, Throwable t) {
    String formattedMessage = fullMessage(message);

    final Object[] paramsWithThrowable;

    if (t != null) {
        if (params == null) {
            paramsWithThrowable = new Object[1];
            paramsWithThrowable[0] = t;
        } else {
            paramsWithThrowable = Arrays.copyOf(params, params.length + 1);
            paramsWithThrowable[params.length] = t;
        }
    }
    else {
        paramsWithThrowable = params;
    }
    switch (level) {
    case LocationAwareLogger.TRACE_INT:
        logger.trace(formattedMessage, paramsWithThrowable);
        break;
    case LocationAwareLogger.DEBUG_INT:
        logger.debug(formattedMessage, paramsWithThrowable);
        break;
    case LocationAwareLogger.INFO_INT:
        logger.info(formattedMessage, paramsWithThrowable);
        break;
    case LocationAwareLogger.WARN_INT:
        logger.warn(formattedMessage, paramsWithThrowable);
        break;
    case LocationAwareLogger.ERROR_INT:
    default:
        logger.error(formattedMessage, paramsWithThrowable);
        break;
    }
}
 
Example 6
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean isWarnEnabled() {
	return getLevel() <= LocationAwareLogger.WARN_INT
			&& delegate.isWarnEnabled();
}
 
Example 7
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean isWarnEnabled(Marker marker) {
	return getLevel() <= LocationAwareLogger.WARN_INT
			&& delegate.isWarnEnabled(marker);
}
 
Example 8
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(String msg) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(msg);
	}
}
 
Example 9
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(String format, Object arg) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(format, arg);
	}
}
 
Example 10
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(String format, Object... arguments) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(format, arguments);
	}
}
 
Example 11
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(String format, Object arg1, Object arg2) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(format, arg1, arg2);
	}
}
 
Example 12
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(String msg, Throwable t) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(msg, t);
	}
}
 
Example 13
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(Marker marker, String msg) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(marker, msg);
	}
}
 
Example 14
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(Marker marker, String format, Object arg) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(marker, format, arg);
	}
}
 
Example 15
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(Marker marker, String format, Object arg1, Object arg2) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(marker, format, arg1, arg2);
	}
}
 
Example 16
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(Marker marker, String format, Object... arguments) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(marker, format, arguments);
	}
}
 
Example 17
Source File: LevelledLoggerWrapper.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void warn(Marker marker, String msg, Throwable t) {
	if (getLevel() <= LocationAwareLogger.WARN_INT) {
		delegate.warn(marker, msg, t);
	}
}