Java Code Examples for org.apache.log4j.Level#DEBUG_INT

The following examples show how to use org.apache.log4j.Level#DEBUG_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: DbEventRequestProcessor.java    From ats-framework with Apache License 2.0 6 votes vote down vote up
private int convertMsgLevel( org.apache.log4j.Level level ) {

        switch (level.toInt()) {
            case Level.FATAL_INT:
                return 1;
            case Level.ERROR_INT:
                return 2;
            case Level.WARN_INT:
                return 3;
            case Level.INFO_INT:
                return 4;
            case Level.DEBUG_INT:
                return 5;
            case Level.TRACE_INT:
                return 6;
            case SystemLogLevel.SYSTEM_INT:
                return 7;
            default:
                return 4;
        }
    }
 
Example 2
Source File: AbstractLoggingBolt.java    From cognition with Apache License 2.0 6 votes vote down vote up
protected void log(Logger logger, String message) {
  switch (level.toInt()) {
    case Level.TRACE_INT:
      logger.trace(message);
      break;
    case Level.DEBUG_INT:
      logger.debug(message);
      break;
    case Level.INFO_INT:
      logger.info(message);
      break;
    case Level.WARN_INT:
      logger.warn(message);
      break;
    case Level.ERROR_INT:
      logger.error(message);
      break;
    default:
      logger.debug(message);
  }
}
 
Example 3
Source File: InstrumentedAppender.java    From client_java with Apache License 2.0 6 votes vote down vote up
@Override
protected void append(LoggingEvent event) {
  switch (event.getLevel().toInt()) {
    case Level.TRACE_INT:
      TRACE_LABEL.inc();
      break;
    case Level.DEBUG_INT:
      DEBUG_LABEL.inc();
      break;
    case Level.INFO_INT:
      INFO_LABEL.inc();
      break;
    case Level.WARN_INT:
      WARN_LABEL.inc();
      break;
    case Level.ERROR_INT:
      ERROR_LABEL.inc();
      break;
    case Level.FATAL_INT:
      FATAL_LABEL.inc();
      break;
    default:
      break;
  }
}
 
Example 4
Source File: Console.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void append(LoggingEvent evt) {
	if (stream.isClosed())
		return;
	String message;
	if (evt.getLevel().toInt() <= Level.DEBUG_INT) {
		LocationInfo info = evt.getLocationInformation();
		message = "" + evt.getLevel().toString()
				+ " [" + DateFormatUtils.format(evt.timeStamp, "HH:mm:ss.SS") + "]"
				+ " @" + info.getClassName()
				+ ">" + info.getMethodName()
				+ ">" + info.getLineNumber()
				+ " - " + evt.getMessage();
	} else {
		message = "" + evt.getLevel().toString()
				+ " - " + evt.getMessage();
	}
	tryPrintMessage(message, evt.getThrowableInformation());
}
 
Example 5
Source File: LogManager.java    From pegasus with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the debug level. All those messages are logged which have a level less than equal to the
 * debug level.
 *
 * @param level the level to which the debug level needs to be set to.
 */
public void setLevel(Level level) {
    int value = level.toInt();
    switch (value) {
        case Level.DEBUG_INT:
            value = LogManager.DEBUG_MESSAGE_LEVEL;
            break;

        case Level.INFO_INT:
            value = LogManager.INFO_MESSAGE_LEVEL;
            break;

        case Level.WARN_INT:
            value = LogManager.WARNING_MESSAGE_LEVEL;
            break;

        case Level.ERROR_INT:
            value = LogManager.ERROR_MESSAGE_LEVEL;
            break;

        default:
            value = LogManager.FATAL_MESSAGE_LEVEL;
            break;
    }
    setLevel(value, false);
}
 
Example 6
Source File: Default.java    From pegasus with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the debug level. All those messages are logged which have a level less than equal to the
 * debug level.
 *
 * @param level the level to which the debug level needs to be set to.
 */
public void setLevel(Level level) {
    int value = level.toInt();
    switch (value) {
        case Level.DEBUG_INT:
            value = Default.DEBUG_MESSAGE_LEVEL;
            break;

        case Level.INFO_INT:
            value = Default.INFO_MESSAGE_LEVEL;
            break;

        case Level.WARN_INT:
            value = Default.WARNING_MESSAGE_LEVEL;
            break;

        case Level.ERROR_INT:
            value = Default.ERROR_MESSAGE_LEVEL;
            break;

        default:
            value = Default.FATAL_MESSAGE_LEVEL;
            break;
    }
    setLevel(value, false);
}
 
Example 7
Source File: LogWriter.java    From Bats with Apache License 2.0 5 votes vote down vote up
private void writeToLog(final String s) {
  if ((s == null) || s.isEmpty()) {
    return;
  }

  switch(level) {
  case Level.DEBUG_INT:
    logger.debug(s);
    break;

  case Level.ERROR_INT:
    logger.error(s);
    break;

  case Level.INFO_INT:
    logger.info(s);
    break;

  case Level.TRACE_INT:
    logger.trace(s);
    break;

  case Level.WARN_INT:
    logger.warn(s);
    break;

  default:
    throw new IllegalStateException();
  }
}
 
Example 8
Source File: UnifiedSystemLogAppender.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void append(final LoggingEvent event) {
    if(null == event.getMessage()) {
        return;
    }
    // Category name
    final String logger = String.format("%s %s", event.getThreadName(), event.getLogger().getName());
    switch(event.getLevel().toInt()) {
        case Level.FATAL_INT:
        case Level.ERROR_INT:
            this.log(OS_LOG_TYPE_ERROR, logger, event.getMessage().toString());
            break;
        case Level.TRACE_INT:
        case Level.DEBUG_INT:
            this.log(OS_LOG_TYPE_DEBUG, logger, event.getMessage().toString());
            break;
        case Level.INFO_INT:
            this.log(OS_LOG_TYPE_INFO, logger, event.getMessage().toString());
            break;
        case Level.WARN_INT:
        default:
            this.log(OS_LOG_TYPE_DEFAULT, logger, event.getMessage().toString());
            break;
    }
    if(layout.ignoresThrowable()) {
        // Appender responsible for rendering
        final String[] trace = event.getThrowableStrRep();
        if(trace != null) {
            for(final String t : trace) {
                this.log(OS_LOG_TYPE_DEFAULT, logger, t);
            }
        }
    }
}
 
Example 9
Source File: AOSynchronization.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("squid:S3776")
private void logWithContext(TaskId taskId, String channel, String message, Throwable exception, Level level)
        throws InvalidChannelException {
    String channelHeader = "[" + Synchronization.class.getSimpleName() + "]" +
                           (channel != null ? "[" + Channel.class.getSimpleName() + "=" + channel + "] " : "");
    switch (level.toInt()) {
        case Level.TRACE_INT:
            if (logger.isTraceEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.DEBUG_INT:
            if (logger.isDebugEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.INFO_INT:
            if (logger.isInfoEnabled()) {
                TaskLogger.getInstance().info(taskId, channelHeader + message);
            }
            break;
        case Level.WARN_INT:
            if (exception != null) {
                TaskLogger.getInstance().warn(taskId, channelHeader + message, exception);
            } else {
                TaskLogger.getInstance().warn(taskId, channelHeader + message);
            }
            break;
        case Level.ERROR_INT:
            if (exception != null) {
                TaskLogger.getInstance().error(taskId, channelHeader + message, exception);
            } else {
                TaskLogger.getInstance().error(taskId, channelHeader + message);
            }
            break;
        default:
            // no action
    }
    if (logger.isTraceEnabled() && channel != null) {
        TaskLogger.getInstance().info(taskId, channelHeader + "New channel content : " + getChannel(channel));
    }
}