Example usage for java.util.logging Level WARNING

List of usage examples for java.util.logging Level WARNING

Introduction

In this page you can find the example usage for java.util.logging Level WARNING.

Prototype

Level WARNING

To view the source code for java.util.logging Level WARNING.

Click Source Link

Document

WARNING is a message level indicating a potential problem.

Usage

From source file:ductive.log.JDKToCommonsHandler.java

@Override
public void publish(LogRecord record) {
    String name = record.getLoggerName();

    Log log = logs.get(name);/*from  w  w w. j ava  2s . c  o m*/
    if (log == null)
        logs.put(name, log = LogFactory.getLog(name));

    String message = record.getMessage();
    Throwable ex = record.getThrown();
    Level level = record.getLevel();

    if (Level.SEVERE == level)
        log.error(message, ex);
    else if (Level.WARNING == level)
        log.warn(message, ex);
    else if (Level.INFO == level)
        log.info(message, ex);
    else if (Level.CONFIG == level)
        log.debug(message, ex);
    else
        log.trace(message, ex);
}

From source file:com.byd.test.actions.OrderAction.java

License:asdf

@RequestMapping("helloworld")
public String helloworld(Model model) {
    Logger.getLogger(OrderAction.class.getName()).log(Level.WARNING, "", "");
    orderService.test();//  w ww  .  j a va  2 s .  c  o m
    System.out.println("ioioioioioioiioiioioioiioioioioioioioioioio" + new Date());
    Order order = new Order("D", "G");
    model.addAttribute(order);
    return "success";
}

From source file:com.almende.eve.agent.AgentBuilder.java

/**
 * Builds the.//from w w  w. j a  va 2s  .c om
 * 
 * @return the agent
 */
public Agent build() {
    if (parameters == null) {
        LOG.warning("AgentBuilder is not yet initialized!");
        return null;
    }
    final AgentConfig params = AgentConfig.decorate(parameters);
    final String className = params.getClassName();
    if (className == null) {
        LOG.warning("AgentBuilder requires configuration parameters: class");
        return null;
    }
    try {
        final Class<?> clazz = Class.forName(className, true, cl);
        if (clazz.equals(Agent.class) || ClassUtil.hasSuperClass(clazz, Agent.class)) {
            final Agent agent = (Agent) clazz.newInstance();
            agent.setConfig(parameters);
            return agent;
        } else {
            LOG.warning("The requested class doesn't extend Agent, which is required for the AgentBuilder");
        }
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Couldn't instantiate the agentclass", e);
    }
    return null;
}

From source file:jp.go.nict.langrid.p2pgridbasis.data.langrid.converter.BlobConverter.java

@SuppressWarnings("rawtypes")
public Object convert(Class type, Object value) {
    if (value == null) {
        return null;
    }/*from  w ww  .jav a  2  s . c  o m*/

    try {
        if (String.class.equals(type)) {
            if (value instanceof Blob) {
                return StreamUtil.readAsString(((Blob) value).getBinaryStream(), decoder);
            } else {
                return value.toString();
            }
        } else if (Blob.class.isAssignableFrom(type) && String.class.isInstance(value)) {
            String str = (String) value;
            return LobUtil.createBlob(Base64.decode(str));
        }
    } catch (SQLException e) {
        logger.log(Level.WARNING, "failed to convert value.", e);
        return null;
    } catch (IOException e) {
        logger.log(Level.WARNING, "failed to convert value.", e);
        return null;
    }
    return null;
}

From source file:com.subgraph.vega.impl.scanner.modules.scripting.CrawlerCallbackWrapper.java

@Override
public void processResponse(IWebCrawler crawler, HttpUriRequest request, IHttpResponse response,
        Object argument) {/*w w w . ja  va  2s  . c o  m*/
    if (!(argument instanceof IInjectionModuleContext)) {

    }
    final IInjectionModuleContext ctx = (IInjectionModuleContext) argument;
    final Scriptable scope = callbackFunction.getParentScope();
    try {
        final Context cx = Context.enter();
        final Object[] arguments = { request, createResponse(response, cx, scope), new ModuleContextJS(ctx) };
        callbackFunction.call(cx, scope, scope, arguments);
    } catch (WrappedException e) {
        logger.log(Level.WARNING,
                new RhinoExceptionFormatter("Wrapped exception running module script", e).toString());
        e.printStackTrace();
    } catch (RhinoException e) {
        logger.warning(new RhinoExceptionFormatter("Exception running module script.", e).toString());
    } finally {
        Context.exit();
    }
}

From source file:com.agiletec.aps.util.ForJLogger.java

public boolean isWarnEnabled() {
    return _log.isLoggable(Level.WARNING);
}

From source file:ch.iterate.openstack.swift.io.HttpMethodReleaseInputStream.java

/**
 * This will force close the connection if the content has not been fully consumed
 *
 * @throws IOException if an I/O error occurs
 * @see CloseableHttpResponse#close()// w  w w .  j  a v a  2  s  .  c o m
 * @see HttpConnection#shutdown()
 */
@Override
public void close() throws IOException {
    if (response instanceof CloseableHttpResponse) {
        long read = this.getByteCount();
        if (read == response.getEntity().getContentLength()) {
            // Fully consumed
            super.close();
        } else {
            if (log.isLoggable(Level.WARNING)) {
                log.warning(String.format("Abort connection for response %s", response));
            }
            // Close an HTTP response as quickly as possible, avoiding consuming
            // response data unnecessarily though at the expense of making underlying
            // connections unavailable for reuse.
            // The response proxy will force close the connection.
            ((CloseableHttpResponse) response).close();
        }
    } else {
        // Consume and close
        super.close();
    }
}

From source file:org.osiam.auth.exception.OsiamExceptionHandler.java

@ExceptionHandler(value = { Exception.class })
protected ModelAndView handleConflict(HttpServletRequest request, Exception e) {
    LOGGER.log(Level.WARNING, "An exception occurred", e);
    return new ModelAndView("oauth_error");
}

From source file:ca.sfu.federation.action.ShowHelpWebSiteAction.java

/**
 * Handle action performed event.//  w ww.j av a2  s .  c  o m
 * @param ae Event
 */
public void actionPerformed(ActionEvent ae) {
    try {
        URI uri = new URI(ApplicationContext.PROJECT_HELP_WEBSITE_URL);
        // open the default web browser for the HTML page
        logger.log(Level.INFO, "Opening desktop browser to {0}", uri.toString());
        Desktop.getDesktop().browse(uri);
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not open browser for help web site {0}\n\n{1}",
                new Object[] { ApplicationContext.PROJECT_HELP_WEBSITE_URL, stack });
    }
}

From source file:com.moneydance.modules.features.importlist.io.MacOSDirectoryChooser.java

@Override
void chooseBaseDirectory() {
    System.setProperty("apple.awt.fileDialogForDirectories", "true");
    final FileDialog fileDialog = new FileDialog((Frame) null, this.getLocalizable().getDirectoryChooserTitle(),
            FileDialog.LOAD);/*from w  w  w. j av a2 s.c om*/
    fileDialog.setModal(true);
    fileDialog.setFilenameFilter(DirectoryValidator.INSTANCE);

    try {
        fileDialog.setDirectory(FileUtils.getUserDirectory().getAbsolutePath());
    } catch (SecurityException e) {
        LOG.log(Level.WARNING, e.getMessage(), e);
    }

    if (this.getBaseDirectory() != null) {
        final File parentDirectory = this.getBaseDirectory().getParentFile();
        if (parentDirectory != null) {
            fileDialog.setDirectory(parentDirectory.getAbsolutePath());
        }
    }
    fileDialog.setVisible(true);
    System.setProperty("apple.awt.fileDialogForDirectories", "false");

    if (fileDialog.getFile() == null) {
        return;
    }

    this.getPrefs()
            .setBaseDirectory(new File(fileDialog.getDirectory(), fileDialog.getFile()).getAbsolutePath());

    LOG.info(String.format("Base directory is %s", this.getPrefs().getBaseDirectory()));
}