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

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

Introduction

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

Prototype

boolean isWarnEnabled();

Source Link

Document

Is warn logging currently enabled?

Usage

From source file:net.mikaboshi.intra_mart.tools.log_stats.parser.LineLogParser.java

/**
 * WARN??/*from  w  w  w.  j  a va  2s.c o m*/
 */
@Override
protected void warn(String format, Object... args) {

    Log logger = getLogger();

    if (logger.isWarnEnabled()) {
        logger.warn(String.format("[" + getLogFilePath() + "#" + this.nLine + "] " + format, args));
    }
}

From source file:net.sf.nmedit.jtheme.store2.ImageElement.java

private Image render() {
    if (imageResource == null)
        return null;

    Image image = imageResource.getImage(width, height);

    if (image == null) {
        Log log = LogFactory.getLog(getClass());
        if (log.isWarnEnabled())
            log.warn("Could not open image [width=" + width + ",height=" + height + "] from:" + imageResource);

        return null;
    }//  ww  w.  jav  a 2  s  .  c om

    return image;
}

From source file:com.picocontainer.gems.monitors.CommonsLoggingComponentMonitor.java

/** {@inheritDoc} **/
public Object noComponentFound(final MutablePicoContainer container, final Object key) {
    Log log = this.log != null ? this.log : LogFactory.getLog(ComponentMonitor.class);
    if (log.isWarnEnabled()) {
        log.warn(ComponentMonitorHelper.format(ComponentMonitorHelper.NO_COMPONENT, key));
    }/* w ww  .ja va2s.com*/
    return delegate.noComponentFound(container, key);
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*from w ww  . j  a v a 2  s  .c o  m*/
public static Msg warn(Log log, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(key, varargs);
        log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log     the log where the messages will go
 * @param  locale  the locale to determine what bundle to use
 * @param  key     the resource bundle key name
 * @param  varargs arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//* w  ww .ja  va2s  . com*/
public static Msg warn(Log log, Locale locale, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(locale, key, varargs);
        log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p>
 *
 * @param  log       the log where the messages will go
 * @param  throwable the throwable associated with the log message
 * @param  key       the resource bundle key name
 * @param  varargs   arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *///from   w w w . ja  v  a2 s .c  o  m
public static Msg warn(Log log, Throwable throwable, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(key, varargs);
        logWarnWithThrowable(log, key, msg, throwable);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log      the log where the messages will go
 * @param  basename the base name of the resource bundle
 * @param  key      the resource bundle key name
 * @param  varargs  arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*from  w w w.  j a v  a  2s .co m*/
public static Msg warn(Log log, BundleBaseName basename, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(basename, key, varargs);
        log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p>
 *
 * @param  log       the log where the messages will go
 * @param  throwable the throwable associated with the log message
 * @param  locale    the locale to determine what bundle to use
 * @param  key       the resource bundle key name
 * @param  varargs   arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 */// ww w . j  av a2s.  c om
public static Msg warn(Log log, Throwable throwable, Locale locale, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(locale, key, varargs);
        logWarnWithThrowable(log, key, msg, throwable);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * @param  log      the log where the messages will go
 * @param  basename the base name of the resource bundle
 * @param  locale   the locale to determine what bundle to use
 * @param  key      the resource bundle key name
 * @param  varargs  arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *///  w  ww.  j  av a 2 s  .  c om
public static Msg warn(Log log, BundleBaseName basename, Locale locale, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(basename, locale, key, varargs);
        log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg);
        return msg;
    }

    return null;
}

From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java

/**
 * Logs the given message to the log at the warn level. If the log level is not enabled, this method does
 * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned.
 *
 * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p>
 *
 * @param  log       the log where the messages will go
 * @param  throwable the throwable associated with the log message
 * @param  basename  the base name of the resource bundle
 * @param  key       the resource bundle key name
 * @param  varargs   arguments to help fill in the resource bundle message
 *
 * @return if the message was logged, a non-<code>null</code> Msg object is returned
 *//*w ww. j  av  a 2s  . co m*/
public static Msg warn(Log log, Throwable throwable, BundleBaseName basename, String key, Object... varargs) {
    if (log.isWarnEnabled()) {
        Msg msg = Msg.createMsg(basename, key, varargs);
        logWarnWithThrowable(log, key, msg, throwable);
        return msg;
    }

    return null;
}