List of usage examples for java.util.logging Level WARNING
Level WARNING
To view the source code for java.util.logging Level WARNING.
Click Source Link
From source file:Jimbo.Cheerlights.Listener.java
/** * Setup the appropriate inputs to feed into the target. It parses * the command line for the available options and creates them as needed. * /*w ww . j a v a2 s .c om*/ * @param args The command line arguments * @param target The CheerListener to feed data into * * @return If anything was created. */ public static boolean setup(String args[], CheerListener target) { // Decode the command line arguments Options options = new Options(); options.addOption("b", MQTT_BROKER_KEY, true, "URL of the broker") .addOption("c", MQTT_CLIENT_KEY, true, "Client ID") .addOption("t", MQTT_TOPIC_KEY, true, "Topic to subscribe to") .addOption("m", "multicast", false, "enable multicast listener"); target.add_options(options); CommandLineParser parser = new DefaultParser(); CommandLine command; boolean something_worked = false; try { // Parse it up command = parser.parse(options, args); target.handle_args(command); MQTTListener mqtt = null; String mqtt_topic = Listener.DEFAULT_MQTT_TOPIC; if (command.hasOption(Listener.MQTT_BROKER_KEY)) { if (!command.hasOption(Listener.MQTT_CLIENT_KEY)) throw new ParseException("MQTT without client name"); if (command.hasOption(Listener.MQTT_TOPIC_KEY)) mqtt_topic = command.getOptionValue(Listener.MQTT_TOPIC_KEY); try { mqtt = new MQTTListener(command.getOptionValue(Listener.MQTT_BROKER_KEY), command.getOptionValue(Listener.MQTT_CLIENT_KEY), mqtt_topic, target); something_worked = true; } catch (MqttException e) { LOG.log(Level.WARNING, "Failed to create MQTT client: {0}", e.getLocalizedMessage()); } } else { if (command.hasOption(Listener.MQTT_TOPIC_KEY)) LOG.warning("MQTT topic supplied but no broker"); if (command.hasOption(Listener.MQTT_CLIENT_KEY)) LOG.warning("MQTT client name but no broker"); } if (command.hasOption("multicast")) { MessageListener l = new MessageListener(target); l.go(); something_worked = true; } } catch (ParseException e) { System.err.println("Command line arguments failed: " + e.getLocalizedMessage()); } return something_worked; }
From source file:com.github.cc007.longcommand.LongCommandCommand.java
@Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { if (!(sender instanceof Player)) { plugin.getLogger().log(Level.WARNING, "This plugin is for player use only."); return false; }//from www . j ava2 s . co m return onPlayerCommand((Player) sender, command, commandLabel, args); }
From source file:com.almende.eve.transport.ws.WsClientTransport.java
/** * Instantiates a new websocket transport. * //www .j a v a2 s . c om * @param address * the address * @param handle * the handle * @param service * the service * @param params * the params */ public WsClientTransport(final URI address, final Handler<Receiver> handle, final TransportService service, final ObjectNode params) { super(address, handle, service, params); final WebsocketTransportConfig config = WebsocketTransportConfig.decorate(params); final String sURL = config.getServerUrl(); if (sURL != null) { try { serverUrl = URIUtil.parse(sURL); } catch (final URISyntaxException e) { LOG.log(Level.WARNING, "'serverUrl' parameter couldn't be parsed", e); } } else { LOG.warning("'serverUrl' parameter is required!"); } myId = config.getId(); }
From source file:com.levalo.contacts.view.ContactView.java
public void doRemoveContact(Contact contact) { try {//ww w .ja v a2s . c om contactService.remove(contact); } catch (ServiceException ex) { logger.log(Level.WARNING, ex.getMessage()); } }
From source file:net.chrissearle.spring.twitter.spring.Twitter4jDirectMessageService.java
private void sendMessage(String friend, String text) { try {/*w ww . j a v a2 s. com*/ if (canSendTo(friend)) { twitter.sendDirectMessage(friend, text); } else { final String message = new StringBuilder().append("Unable to DM ").append(friend) .append(" - not friends").toString(); if (logger.isLoggable(Level.WARNING)) { logger.warning(message); } throw new TwitterServiceException(message); } } catch (TwitterException e) { final String message = new StringBuilder().append("Unable to DM ").append(friend) .append(" with message ").append(text).append(" due to ").append(e.getMessage()).toString(); if (logger.isLoggable(Level.WARNING)) { logger.warning(message); } throw new TwitterServiceException(message, e); } }
From source file:de.static_interface.sinklibrary.Logger.java
@Override public void warn(String message) { log(Level.WARNING, message); }
From source file:com.adr.taskexecutor.ui.TaskExecutorRemote.java
/** Creates new form TaskExecutorRemote */ public TaskExecutorRemote() { initComponents();/*w ww .j a v a 2s . c o m*/ jLoggingLevel.addItem(Level.SEVERE); jLoggingLevel.addItem(Level.WARNING); jLoggingLevel.addItem(Level.INFO); jLoggingLevel.addItem(Level.CONFIG); jLoggingLevel.addItem(Level.FINE); jLoggingLevel.addItem(Level.FINER); jLoggingLevel.addItem(Level.FINEST); jLoggingLevel.addItem(Level.OFF); jLoggingLevel.addItem(Level.ALL); jURL.setText(Configuration.getInstance().getPreference("remote.serverurl", "http://localhost/taskexecutoree/executetask")); jLoggingLevel.setSelectedItem(Level .parse(Configuration.getInstance().getPreference("remote.logginglevel", Level.INFO.toString()))); jTrace.setSelected(Boolean .parseBoolean(Configuration.getInstance().getPreference("remote.trace", Boolean.FALSE.toString()))); jStats.setSelected(Boolean .parseBoolean(Configuration.getInstance().getPreference("remote.stats", Boolean.TRUE.toString()))); }
From source file:io.fabric8.kubernetes.pipeline.devops.elasticsearch.BuildListener.java
private BuildDTO createBuild(Run run, TaskListener listener) { final Job job = run.getParent(); EnvVars environment = null;/*from w ww .j a v a 2 s . com*/ try { environment = run.getEnvironment(listener); } catch (IOException e) { LOG.log(Level.WARNING, "Error getting environment", e); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Error getting environment", e); } // ES doesnt like '.' in env var key names so replace any with '_' Map<String, String> changeMap = new HashMap<>(); List<String> oldKeys = new ArrayList<>(); for (String key : environment.keySet()) { if (key.contains(".")) { oldKeys.add(key); String value = environment.get(key, ""); changeMap.put(key.replace(".", "_"), value); } } for (String key : oldKeys) { environment.remove(key); } for (Map.Entry<String, String> entry : changeMap.entrySet()) { environment.put(entry.getKey(), entry.getValue()); } final BuildDTO build = new BuildDTO(); long duration = System.currentTimeMillis() - run.getStartTimeInMillis(); build.setDuration(duration); build.setApp(job.getFullName()); Result result = run.getResult(); if (result != null) { build.setBuildResult(result.toString()); } build.setStartTime(new Date(run.getStartTimeInMillis())); build.setBuildNumber(run.getNumber()); build.setEnvVars(environment); Calendar timestamp = run.getTimestamp(); if (timestamp != null) { build.setTimestamp(timestamp.getTime()); } build.setBuildUrl(run.getUrl()); List<Cause> causes = run.getCauses(); for (Cause cause : causes) { CauseDTO causeDTO = new CauseDTO(cause); if (causeDTO != null) { build.addCause(causeDTO); } } return build; }
From source file:com.almende.eve.protocol.jsonrpc.JSONRpcProtocolBuilder.java
@Override public JSONRpcProtocol build() { JSONRpcProtocolConfig config = JSONRpcProtocolConfig.decorate(getParams()); String id = config.getId();/*from ww w. java 2s . c o m*/ if (id == null) { id = new UUID().toString(); LOG.warning("Parameter 'id' is required for JSONRpcProtocol. (giving temporary name: " + id + ")"); } JSONRpcProtocol result; if (INSTANCES.containsKey(id)) { result = INSTANCES.get(id); final Handler<Object> oldHandle = result.getHandle(); oldHandle.update(TYPEUTIL.inject(getHandle())); } else { result = new JSONRpcProtocol(getParams(), TYPEUTIL.inject(getHandle())); } INSTANCES.put(id, result); // Add authorizor: try { @SuppressWarnings("unchecked") final Class<Authorizor> clazz = (Class<Authorizor>) Class.forName(config.getAuthorizor()); result.setAuth(clazz.newInstance()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOG.log(Level.WARNING, "Couldn't instantiate authorizor class:" + config.getAuthorizor(), e); } return result; }
From source file:com.amazon.carbonado.repo.tupl.LogEventListener.java
@Override public void notify(EventType type, String message, Object... args) { int intLevel = type.level.intValue(); Log log = mLog;//from w w w .ja va 2 s . c o m if (log != null) { if (intLevel <= Level.INFO.intValue()) { if (type.category == EventType.Category.CHECKPOINT) { if (log.isDebugEnabled()) { log.debug(format(type, message, args)); } } else if (log.isInfoEnabled()) { log.info(format(type, message, args)); } } else if (intLevel <= Level.WARNING.intValue()) { if (log.isWarnEnabled()) { log.warn(format(type, message, args)); } } else if (intLevel <= Level.SEVERE.intValue()) { if (log.isFatalEnabled()) { log.fatal(format(type, message, args)); } } } if (intLevel > Level.WARNING.intValue() && mPanicHandler != null) { mPanicHandler.onPanic(mDatabase, type, message, args); } }