Example usage for org.apache.commons.logging Log warn

List of usage examples for org.apache.commons.logging Log warn

Introduction

In this page you can find the example usage for org.apache.commons.logging Log warn.

Prototype

void warn(Object message);

Source Link

Document

Logs a message with warn log level.

Usage

From source file:rocket.logging.server.CommonsLoggingService.java

@Override
protected Logger createLoggerAdapter(final String loggerName) {
    final Log log = LogFactory.getLog(loggerName);
    return new Logger() {
        public void debug(final String message) {
            log.debug(message);/*  w  w w. j av a 2 s  .  com*/
        }

        public void debug(final String message, final Throwable throwable) {
            log.debug(message, throwable);
        }

        public void info(final String message) {
            log.info(message);
        }

        public void info(final String message, final Throwable throwable) {
            log.info(message, throwable);
        }

        public void warn(final String message) {
            log.warn(message);
        }

        public void warn(final String message, final Throwable throwable) {
            log.warn(message, throwable);
        }

        public void error(final String message) {
            log.error(message);
        }

        public void error(final String message, final Throwable throwable) {
            log.error(message, throwable);
        }

        public void fatal(final String message) {
            log.fatal(message);
        }

        public void fatal(final String message, final Throwable throwable) {
            log.fatal(message, throwable);
        }

        public boolean isDebugEnabled() {
            return log.isDebugEnabled();
        }

        public boolean isInfoEnabled() {
            return log.isInfoEnabled();
        }

        public boolean isWarnEnabled() {
            return log.isWarnEnabled();
        }

        public boolean isErrorEnabled() {
            return log.isErrorEnabled();
        }

        public boolean isFatalEnabled() {
            return log.isFatalEnabled();
        }
    };
}

From source file:volker.streaming.music.PropertiesUtil.java

public static Properties readFile(Log log, File file) {
    InputStream stream = null;/*from w  ww  .  j  a  v  a2 s  . c om*/
    Properties properties = new Properties();
    log.info("Reading from config file");
    try {
        if (file == null) {
            log.warn("No config file given");
        } else {
            stream = new FileInputStream(file);
            properties.load(stream);
        }
    } catch (FileNotFoundException e) {
        log.error("Config file not found", e);
    } catch (SecurityException e) {
        log.error("No read access for config file", e);
    } catch (IllegalArgumentException e) {
        log.error("Improper config format", e);
    } catch (IOException e) {
        log.error("IO failure while reading config file", e);
    } finally {
        if (stream != null) {
            try {
                stream.close();
            } catch (IOException e) {
                log.warn("Failed to close stream to config file");
            }
        }
    }
    return properties;
}

From source file:xbird.xquery.func.PredefinedFunctions.java

private static void activateUserExtentions(final Map<String, String> r) {
    final String providerClazz = Settings.get("xbird.xquery.func.provider");
    if (providerClazz != null && providerClazz.length() > 0) {
        Object obj = ObjectUtils.instantiateSafely(providerClazz);
        if (obj != null && (obj instanceof FunctionProvider)) {
            FunctionProvider provider = (FunctionProvider) obj;
            final List<? extends BuiltInFunction> funcs = provider.injectedFunctions();
            if (funcs != null) {
                final Log LOG = LogFactory.getLog(PredefinedFunctions.class);
                for (BuiltInFunction f : funcs) {
                    QualifiedName qname = f.getName();
                    String name = QNameUtil.toLexicalForm(qname);
                    String prefix = qname.getPrefix();
                    if (BuiltInFunction.EXT_NSPREFIX.equals(prefix)) {
                        table.put(name, f);
                        String clazzName = f.getClass().getName();
                        r.put(name, clazzName);
                    } else {
                        LOG.warn("loading a BuiltInFunction is discarded: " + name);
                    }/*from w w w . j a  v a  2s. c om*/

                }
            }
        } else {
            Log LOG = LogFactory.getLog(PredefinedFunctions.class);
            LOG.warn("Illegal FunctionProvider: " + providerClazz);
        }
    }
}

From source file:xdoclet.modules.ojb.LogHelper.java

/**
 * Logs the given warning to stdout and to the log for the given class
 * (if the log level has been set to warn or higher).
 * //  w w w.  j  av a2 s . c  o m
 * @param alsoStdout Whether to also put the message to stdout
 * @param clazz      The clazz
 * @param posInfo    The position info, e.g. method name
 * @param msg        The message
 */
public static void warn(boolean alsoStdout, Class clazz, String posInfo, Object msg) {
    if (alsoStdout) {
        System.out.println("Warning: " + msg.toString());
    }

    String name = clazz.getName();

    if (posInfo != null) {
        name += "." + posInfo;
    }

    Log log = LogFactory.getLog(name);

    if (log.isWarnEnabled()) {
        log.warn(msg);
    }
}