Java Code Examples for java.util.logging.Level.WARNING

The following are Jave code examples for showing how to use WARNING of the java.util.logging.Level class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SamaGamesAPI   File: SamaGamesAPI.java   View Source Code Vote up 6 votes
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) {}
}
 
Example 2
Project: incubator-netbeans   File: ErrorManager.java   View Source Code Vote up 6 votes
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;
}
 
Example 3
Project: spring-boot-data-source-decorator   File: ProxyDataSourceBuilderConfigurer.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 4
Project: incubator-netbeans   File: NetbinoxHooks.java   View Source Code Vote up 6 votes
@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);
}
 
Example 5
Project: incubator-netbeans   File: LogRecordsTest.java   View Source Code Vote up 5 votes
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;
}
 
Example 6
Project: incubator-netbeans   File: DecorableTest.java   View Source Code Vote up 5 votes
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);
}
 
Example 7
Project: WebSandboxMC   File: SettingsSponge.java   View Source Code Vote up 5 votes
@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);
    }
}
 
Example 8
Project: ios-device-control   File: CommandProcess.java   View Source Code Vote up 5 votes
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);
  }
}
 
Example 9
Project: incubator-netbeans   File: MenuBarNotInAWTTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.WARNING;
}
 
Example 10
Project: GitHub   File: Platform.java   View Source Code Vote up 4 votes
public void log(int level, String message, Throwable t) {
  Level logLevel = level == WARN ? Level.WARNING : Level.INFO;
  logger.log(logLevel, message, t);
}
 
Example 11
Project: springbootWeb   File: JdkLoggingImpl.java   View Source Code Vote up 4 votes
public void warn(String s) {
    LogRecord lr = new LogRecord(Level.WARNING, s);
    lr.setSourceClassName(log.getName());

    log.log(lr);
}
 
Example 12
Project: Elasticsearch   File: JdkESLogger.java   View Source Code Vote up 4 votes
@Override
protected void internalWarn(String msg, Throwable cause) {
    LogRecord record = new ESLogRecord(Level.WARNING, msg);
    record.setThrown(cause);
    logger.log(record);
}
 
Example 13
Project: server-utility   File: JdkLoggingImpl.java   View Source Code Vote up 4 votes
public void warn(String s) {
    LogRecord lr = new LogRecord(Level.WARNING, s);
    lr.setSourceClassName(log.getName());

    log.log(lr);
}
 
Example 14
Project: incubator-netbeans   File: LoggingTest.java   View Source Code Vote up 4 votes
protected Level logLevel() {
    return Level.WARNING;
}
 
Example 15
Project: incubator-netbeans   File: StdOutNoLogTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.WARNING;
}
 
Example 16
Project: org.mybatis.generator.core-1.3.5   File: JdkLoggingImpl.java   View Source Code Vote up 4 votes
public void warn(String s) {
    LogRecord lr = new LogRecord(Level.WARNING, s);
    lr.setSourceClassName(log.getName());

    log.log(lr);
}
 
Example 17
Project: incubator-netbeans   File: LuceneIndexTest.java   View Source Code Vote up 4 votes
@Override
public void publish(LogRecord record) {
    if (record.getLevel() == Level.WARNING && record.getThrown() != null) {
        warning = true;
    }
}
 
Example 18
Project: incubator-netbeans   File: AntArtifactTest.java   View Source Code Vote up 4 votes
protected @Override Level logLevel() {
    return Level.WARNING;
}
 
Example 19
Project: incubator-netbeans   File: ChildrenAsUsedInExplorerTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.WARNING;
}
 
Example 20
Project: incubator-netbeans   File: MenuBarSeparatorInAWTTest.java   View Source Code Vote up 4 votes
@Override
protected Level logLevel() {
    return Level.WARNING;
}