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

The following examples show how to use org.apache.log4j.Level#ALL . 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: LogEventAdapter.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
/**
 * Return the level of this event. Use this form instead of directly
 * accessing the <code>level</code> field.  */
@Override
public Level getLevel() {
    switch (StandardLevel.getStandardLevel(event.getLevel().intLevel())) {
        case TRACE:
            return Level.TRACE;
        case DEBUG:
            return Level.DEBUG;
        case INFO:
            return Level.INFO;
        case WARN:
            return Level.WARN;
        case ERROR:
            return Level.ERROR;
        case FATAL:
            return Level.FATAL;
        case OFF:
            return Level.OFF;
        case ALL:
            return Level.ALL;
        default:
            return Level.ERROR;
    }
}
 
Example 2
Source File: LogEventAdapter.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
/**
 * Return the level of this event. Use this form instead of directly
 * accessing the <code>level</code> field.
 */
@Override
public Level getLevel() {
    switch (StandardLevel.getStandardLevel(event.getLevel().intLevel())) {
        case TRACE:
            return Level.TRACE;
        case DEBUG:
            return Level.DEBUG;
        case INFO:
            return Level.INFO;
        case WARN:
            return Level.WARN;
        case FATAL:
            return Level.FATAL;
        case OFF:
            return Level.OFF;
        case ALL:
            return Level.ALL;
        default:
            return Level.ERROR;
    }
}
 
Example 3
Source File: OptionConverter.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
public static Level convertLevel(org.apache.logging.log4j.Level level) {
    if (level == null) {
        return Level.ERROR;
    }
    switch (level.getStandardLevel()) {
        case FATAL:
            return Level.FATAL;
        case WARN:
            return Level.WARN;
        case INFO:
            return Level.INFO;
        case DEBUG:
            return Level.DEBUG;
        case TRACE:
            return Level.TRACE;
        case ALL:
            return Level.ALL;
        case OFF:
            return Level.OFF;
        default:
            return Level.ERROR;
    }
}
 
Example 4
Source File: SwiftLogInfo.java    From swift-k with Apache License 2.0 6 votes vote down vote up
private static Priority getLevel(String s) {
    if ("WARN".equals(s)) {
        return Level.WARN;
    }
    else if ("ERROR".equals(s)) {
        return Level.ERROR;
    }
    else if ("INFO".equals(s)) {
        return Level.INFO;
    }
    else if ("DEBUG".equals(s)) {
        return Level.DEBUG;
    }
    else {
        return Level.ALL;
    }
}
 
Example 5
Source File: IngestUtilities.java    From cognition with Apache License 2.0 6 votes vote down vote up
public static Level levelFromString(String level) {
  String ulevel = level.toUpperCase();
  if (ulevel.equals("ALL")) {
    return Level.ALL;
  } else if (ulevel.equals("DEBUG")) {
    return Level.DEBUG;
  } else if (ulevel.equals("ERROR")) {
    return Level.ERROR;
  } else if (ulevel.equals("FATAL")) {
    return Level.FATAL;
  } else if (ulevel.equals("INFO")) {
    return Level.INFO;
  } else if (ulevel.equals("OFF")) {
    return Level.OFF;
  } else if (ulevel.equals("TRACE")) {
    return Level.TRACE;
  } else if (ulevel.equals("WARN")) {
    return Level.WARN;
  }
  return Level.INFO;
}
 
Example 6
Source File: ShardTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    Level desiredLevel = Level.ALL;
    
    Logger log = Logger.getLogger(ShardTableConfigHelperTest.class);
    ShardTableConfigHelperTest.testDriverLevel = log.getLevel();
    log.setLevel(desiredLevel);
}
 
Example 7
Source File: LoggerPreference.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private static Level getLevelForId(String levelId) {
	switch (levelId) {
	case LEVEL_ALL:
		return Level.ALL;
	case LEVEL_INFO:
		return Level.INFO;
	case LEVEL_WARN:
		return Level.WARN;
	case LEVEL_ERROR:
		return Level.ERROR;
	}
	return Level.INFO;
}
 
Example 8
Source File: Section.java    From JTAF-XCore with Apache License 2.0 5 votes vote down vote up
/**
 * Private constructor used to create subsections
 * @param text
 * @param parent
 */
private Section(String text, Section parent) {
	this.text        = text;
	this.parent      = parent;
	this.subsections = new ArrayList<Section>();
	this.messages    = new LinkedList<Message>();
	this.level       = Level.ALL;
}
 
Example 9
Source File: Log4j.java    From pegasus with Apache License 2.0 5 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. In case the boolean info is set, all the info messages are also logged.
 *
 * @param level the level to which the debug level needs to be set to.
 * @param info boolean denoting whether the INFO messages need to be logged or not.
 */
protected void setLevel(int level, boolean info) {
    Level l = Level.ALL;
    switch (level) {
        case LogManager.FATAL_MESSAGE_LEVEL:
            l = Level.FATAL;
            break;

        case LogManager.ERROR_MESSAGE_LEVEL:
            l = Level.ERROR;
            break;

        case LogManager.WARNING_MESSAGE_LEVEL:
            l = Level.WARN;
            break;

        case LogManager.CONFIG_MESSAGE_LEVEL:
            l = Level.INFO;
            break;

        case LogManager.INFO_MESSAGE_LEVEL:
            l = Level.INFO;
            break;

        case LogManager.DEBUG_MESSAGE_LEVEL:
            l = Level.DEBUG;
            break;
    }
    mLogger.setLevel(l);
}
 
Example 10
Source File: OraOopUtilities.java    From aliyun-maxcompute-data-collectors with Apache License 2.0 5 votes vote down vote up
public static boolean enableDebugLoggingIfRequired(
    org.apache.hadoop.conf.Configuration conf) {

  boolean result = false;

  try {

    Level desiredOraOopLoggingLevel =
        Level.toLevel(conf.get(OraOopConstants.ORAOOP_LOGGING_LEVEL),
            Level.INFO);

    Level sqoopLogLevel =
        Logger.getLogger(Sqoop.class.getName()).getParent().getLevel();

    if (desiredOraOopLoggingLevel == Level.DEBUG
        || desiredOraOopLoggingLevel == Level.ALL
        || sqoopLogLevel == Level.DEBUG || sqoopLogLevel == Level.ALL) {

      Category oraOopLogger =
          Logger.getLogger(OraOopManagerFactory.class.getName()).getParent();
      oraOopLogger.setLevel(Level.DEBUG);
      LOG.debug("Enabled OraOop debug logging.");
      result = true;

      conf.set(OraOopConstants.ORAOOP_LOGGING_LEVEL, Level.DEBUG.toString());
    }
  } catch (Exception ex) {
    LOG.error(String.format(
        "Unable to determine whether debug logging should be enabled.\n%s",
        getFullExceptionMessage(ex)));
  }

  return result;
}
 
Example 11
Source File: MetadataTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    Level desiredLevel = Level.ALL;
    
    Logger log = Logger.getLogger(MetadataTableConfigHelperTest.class);
    MetadataTableConfigHelperTest.testDriverLevel = log.getLevel();
    log.setLevel(desiredLevel);
}
 
Example 12
Source File: AbstractTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void adjustLogLevels() {
    
    Level desiredLevel = Level.ALL;
    
    Logger log = Logger.getLogger(AbstractTableConfigHelperTest.class);
    AbstractTableConfigHelperTest.testDriverLevel = log.getLevel();
    log.setLevel(desiredLevel);
}
 
Example 13
Source File: DateIndexTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    Level desiredLevel = Level.ALL;
    
    Logger log = Logger.getLogger(DateIndexTableConfigHelperTest.class);
    DateIndexTableConfigHelperTest.testDriverLevel = log.getLevel();
    log.setLevel(desiredLevel);
}
 
Example 14
Source File: TestLog4Json.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public Level getThreshold() {
  return Level.ALL;
}
 
Example 15
Source File: LoggingOutputStream.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
public LoggingOutputStream(Logger log) throws IllegalArgumentException {
    this(log, Level.ALL);
}
 
Example 16
Source File: LoggingEventProcessor.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
public NoWarningHierarchy() {
    super(new RootLogger(Level.ALL));
}
 
Example 17
Source File: LogCaptor.java    From ibm-cos-sdk-java with Apache License 2.0 4 votes vote down vote up
public LogCaptorTestBase() {
    super(Level.ALL);
}
 
Example 18
Source File: LogCaptor.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public LogCaptorTestBase() {
    super(Level.ALL);
}
 
Example 19
Source File: TestLog4Json.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public Level getThreshold() {
  return Level.ALL;
}
 
Example 20
Source File: LogInitializer.java    From DataGenerator with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes log4j
 *
 * @param loggerLevel log level to initialize to
 */
public static void initialize(String loggerLevel) {
    if (!INIT.compareAndSet(false, true)) {
        return;
    }

    BasicConfigurator.resetConfiguration();
    ConsoleAppender consoleAppender = new ConsoleAppender(
        new PatternLayout("<%d{yyMMdd HHmmss} %5p %C{1}:%L> %m%n"), ConsoleAppender.SYSTEM_ERR);
    BasicConfigurator.configure(consoleAppender);

    Level level;

    String logLevel;

    if (loggerLevel != null) {
        logLevel = loggerLevel.toLowerCase();
    } else {
        logLevel = "default";
    }

    switch (logLevel) {
        case "all":
            level = Level.ALL;
            break;
        case "debug":
            level = Level.DEBUG;
            break;
        case "error":
            level = Level.ERROR;
            break;
        case "fatal":
            level = Level.FATAL;
            break;
        case "info":
            level = Level.INFO;
            break;
        case "off":
            level = Level.OFF;
            break;
        case "trace":
            level = Level.TRACE;
            break;
        case "warn":
            level = Level.WARN;
            break;
        default:
            level = Level.INFO;
            break;
    }

    Logger.getRootLogger().setLevel(Level.OFF);
    Logger.getLogger("org.finra").setLevel(level);

    System.err.println("Set loglevel to " + level.toString());
}