當前位置: 首頁>>代碼示例>>Java>>正文


Java Level.WARNING屬性代碼示例

本文整理匯總了Java中java.util.logging.Level.WARNING屬性的典型用法代碼示例。如果您正苦於以下問題:Java Level.WARNING屬性的具體用法?Java Level.WARNING怎麽用?Java Level.WARNING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.logging.Level的用法示例。


在下文中一共展示了Level.WARNING屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: slackLog

public void slackLog(Level level, SlackMessage message)
{
    String color;

    if (level == Level.FINE)
        color = "#2FA44F";
    else if (level == Level.WARNING)
        color = "#DE9E31";
    else if (level == Level.SEVERE)
        color = "#D50200";
    else
        color = "#28D7E5";

    try
    {
        this.getSlackLogsPublisher().push(new SlackAttachment("").color(color).text(message));
    }
    catch (IOException ignored) {}
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:19,代碼來源:SamaGamesAPI.java

示例2: convertSeverity

private static Level convertSeverity(final int severity, boolean forException, Level def) {
    Level sev = def;

    if (severity >= ERROR) {
        sev = Level.SEVERE;
    } else if (severity >= EXCEPTION) {
        sev = Level.SEVERE;
    } else if (severity >= USER) {
        sev = OwnLevel.USER;
    } else if (severity >= WARNING) {
        sev = Level.WARNING;
    } else if (severity >= INFORMATIONAL) {
        sev = forException ? Level.INFO: Level.FINE;
    }
    return sev;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ErrorManager.java

示例3: toJULLogLevel

private Level toJULLogLevel(String logLevel) {
    if (logLevel == null) {
        return null;
    }
    try {
        return Level.parse(logLevel);
    }
    catch (IllegalArgumentException e) {
        if (logLevel.equalsIgnoreCase("DEBUG")) {
            return Level.FINE;
        }
        if (logLevel.equalsIgnoreCase("WARN")) {
            return Level.WARNING;
        }
        throw new IllegalArgumentException("Unresolved log level " + logLevel + " for java.util.logging", e);
    }
}
 
開發者ID:gavlyukovskiy,項目名稱:spring-boot-data-source-decorator,代碼行數:17,代碼來源:ProxyDataSourceBuilderConfigurer.java

示例4: log

@Override
public void log(FrameworkEvent fe) {
    Level l = Level.FINE;
    if ((fe.getType() & FrameworkEvent.ERROR) != 0) {
        l = Level.SEVERE;
    } else if ((fe.getType() & FrameworkEvent.WARNING) != 0) {
        l = Level.WARNING;
    } else if ((fe.getType() & FrameworkEvent.INFO) != 0) {
        l = Level.INFO;
    }
    LogRecord lr = new LogRecord(l, "framework event {0} type {1}");
    lr.setParameters(new Object[]{fe.getBundle().getSymbolicName(), fe.getType()});
    lr.setThrown(fe.getThrowable());
    lr.setLoggerName(NetbinoxFactory.LOG.getName());
    NetbinoxFactory.LOG.log(lr);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:NetbinoxHooks.java

示例5: randomLevel

private static Level randomLevel(Random r) {
    int lev = r.nextInt(1100);
    if (lev >= Level.SEVERE.intValue()) return Level.SEVERE;
    if (lev >= Level.WARNING.intValue()) return Level.WARNING;
    if (lev >= Level.INFO.intValue()) return Level.INFO;
    if (lev >= Level.CONFIG.intValue()) return Level.CONFIG;
    if (lev >= Level.FINE.intValue()) return Level.FINE;
    if (lev >= Level.FINER.intValue()) return Level.FINER;
    if (lev >= Level.FINEST.intValue()) return Level.FINEST;
    return Level.OFF;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:LogRecordsTest.java

示例6: testHasNonNullNameWhenMessageIsGiven

public void testHasNonNullNameWhenMessageIsGiven() throws Exception {
    Exception my = new Exception("Ahoj");
    LogRecord r = new LogRecord(Level.WARNING, my.getMessage());
    r.setThrown(my);
    Node n = UINode.create(r);
    assertNotNull(n);
    assertNotNull(n.getName());
    assertSerializedWell(r, n);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:DecorableTest.java

示例7: log

@Override
public void log(Level level, String message) {
    if (level == Level.FINEST && !debug) {
        return;
    }

    if (level == Level.FINEST) {
        plugin.logger.debug(message);
    } else if (level == Level.WARNING) {
        plugin.logger.warn(message);
    } else {
        plugin.logger.info(message);
    }
}
 
開發者ID:satoshinm,項目名稱:WebSandboxMC,代碼行數:14,代碼來源:SettingsSponge.java

示例8: CommandProcess

protected CommandProcess(Command command, RawProcess rawProcess) throws CommandStartException {
  this.command = checkNotNull(command);
  this.rawProcess = checkNotNull(rawProcess);
  stdoutStream = new CapturingOutputStream();
  stderrStream = new CapturingOutputStream();

  Supplier<Level> ioLogLevel = new Supplier<Level>() {
    @Override
    public Level get() {
      return CommandProcess.this.rawProcess.isAlive() ? Level.WARNING : Level.FINE;
    }
  };

  try {
    stdinPump =
        maybeStartCopyFromSourceToPipe(command.stdinSource(), rawProcess.stdinPipe(), ioLogLevel);
    stdoutPump =
        maybeStartCopyFromPipeToSink(
            rawProcess.stdoutPipe(),
            command.stdoutSink(),
            stdoutStream,
            stderrStream,
            ioLogLevel);
    stderrPump =
        maybeStartCopyFromPipeToSink(
            rawProcess.stderrPipe(),
            command.stderrSink(),
            stdoutStream,
            stderrStream,
            ioLogLevel);
  } catch (IOException e) {
    throw new CommandStartException(command, e);
  }
}
 
開發者ID:google,項目名稱:ios-device-control,代碼行數:34,代碼來源:CommandProcess.java

示例9: logLevel

@Override
protected Level logLevel() {
    return Level.WARNING;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:MenuBarNotInAWTTest.java

示例10: log

public void log(int level, String message, Throwable t) {
  Level logLevel = level == WARN ? Level.WARNING : Level.INFO;
  logger.log(logLevel, message, t);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:Platform.java

示例11: warn

public void warn(String s) {
    LogRecord lr = new LogRecord(Level.WARNING, s);
    lr.setSourceClassName(log.getName());

    log.log(lr);
}
 
開發者ID:DomKing,項目名稱:springbootWeb,代碼行數:6,代碼來源:JdkLoggingImpl.java

示例12: internalWarn

@Override
protected void internalWarn(String msg, Throwable cause) {
    LogRecord record = new ESLogRecord(Level.WARNING, msg);
    record.setThrown(cause);
    logger.log(record);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:6,代碼來源:JdkESLogger.java

示例13: logLevel

protected Level logLevel() {
    return Level.WARNING;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:LoggingTest.java

示例14: publish

@Override
public void publish(LogRecord record) {
    if (record.getLevel() == Level.WARNING && record.getThrown() != null) {
        warning = true;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:LuceneIndexTest.java

示例15: logLevel

protected @Override Level logLevel() {
    return Level.WARNING;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:AntArtifactTest.java


注:本文中的java.util.logging.Level.WARNING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。