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.GenericLogParser.java

/**
 * WARN??//from w  ww.ja  v  a2s.  c  o m
 * @param format
 * @param args
 */
protected void warn(String format, Object... args) {

    Log logger = getLogger();

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

From source file:hadoopInstaller.logging.CompositeLog.java

@Override
public boolean isWarnEnabled() {
    boolean enabled = true;
    for (Log log : this.logs) {
        enabled = enabled && log.isWarnEnabled();
    }/* w ww  .j  ava2  s .  c o m*/
    return enabled;
}

From source file:net.sf.nmedit.nomad.core.service.initService.ExplorerLocationMemory.java

public void init() {
    File file = getTempFile();//from  ww w .j ava  2  s  .c o  m
    if (file.exists() && file.isFile()) {
        Properties p = new Properties();
        InputStream in = null;
        try {
            in = new BufferedInputStream(new FileInputStream(file));
            p.load(in);
        } catch (IOException e) {
            Log log = LogFactory.getLog(getClass());
            if (log.isWarnEnabled()) {
                log.warn("could not read property file", e);
            }
            return;
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                // no op
            }
        }
        createLocations(p);
    }
}

From source file:io.netty.logging.CommonsLoggerTest.java

@Test
public void testIsWarnEnabled() {
    Log mock = createStrictMock(Log.class);

    expect(mock.isWarnEnabled()).andReturn(true);
    replay(mock);/*  w w w .j ava 2 s . c om*/

    InternalLogger logger = new CommonsLogger(mock, "foo");
    assertTrue(logger.isWarnEnabled());
    verify(mock);
}

From source file:net.sf.nmedit.jtheme.store.StorageContext.java

protected Image getImage(URL imageURL) {
    String key = imageURL.toString();
    Image image = imageMap.get(key);
    if (image == null) {
        try {//from w  w w . j a  v a 2  s .  c o  m
            image = ImageIO.read(imageURL);
            imageMap.put(key, image);
        } catch (IOException e) {
            Log log = getLog();
            if (log.isWarnEnabled()) {
                log.warn("getImage(" + imageURL + ") failed", e);
            }
        }
    }
    return image;
}

From source file:fr.gouv.vitam.utils.logging.CommonsLoggerTest.java

@Test
public void testIsWarnEnabled() {
    final Log mock = createStrictMock(Log.class);

    expect(mock.isWarnEnabled()).andReturn(true);
    replay(mock);//w  ww  .  j  ava 2 s. c om

    final VitamLogger logger = new CommonsLogger(mock, "foo");
    assertTrue(logger.isWarnEnabled());
    verify(mock);
}

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

/** {@inheritDoc} **/
public void invocationFailed(final Member member, final Object instance, final Exception cause) {
    Log log = getLog(member);
    if (log.isWarnEnabled()) {
        log.warn(ComponentMonitorHelper.format(ComponentMonitorHelper.INVOCATION_FAILED, memberToString(member),
                instance, cause.getMessage()), cause);
    }//from w  w w  . jav a2  s .  c o m
    delegate.invocationFailed(member, instance, cause);
}

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

/** {@inheritDoc} **/
public void lifecycleInvocationFailed(final MutablePicoContainer container,
        final ComponentAdapter<?> componentAdapter, final Method method, final Object instance,
        final RuntimeException cause) {
    Log log = getLog(method);
    if (log.isWarnEnabled()) {
        log.warn(ComponentMonitorHelper.format(ComponentMonitorHelper.LIFECYCLE_INVOCATION_FAILED,
                methodToString(method), instance, cause != null ? cause.getMessage() : "null"), cause);
    }/*from ww w.  j av a 2 s.  com*/
    delegate.lifecycleInvocationFailed(container, componentAdapter, method, instance, cause);
}

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

/** {@inheritDoc} **/
public <T> void instantiationFailed(final PicoContainer container, final ComponentAdapter<T> componentAdapter,
        final Constructor<T> constructor, final Exception cause) {
    Log log = getLog(constructor);
    if (log.isWarnEnabled()) {
        log.warn(ComponentMonitorHelper.format(ComponentMonitorHelper.INSTANTIATION_FAILED,
                ctorToString(constructor), cause != null ? cause.getMessage() : "null"), cause);
    }/*from   w w w  .ja  v  a  2s .co  m*/
    delegate.instantiationFailed(container, componentAdapter, constructor, cause);
}

From source file:net.sf.nmedit.nordmodular.NmFileService.java

public void newFile() {
    try {/*from   w w w  . ja  v  a  2  s .  c  om*/
        NMPatch patch = new NMPatch(NMData.sharedInstance().getModuleDescriptions());
        PatchDocument pd = createPatchDoc(patch);
        Nomad.sharedInstance().getDocumentManager().add(pd);
        patch.setEditSupportEnabled(true); // enable history
    } catch (Exception e) {
        Log log = LogFactory.getLog(getClass());
        if (log.isWarnEnabled()) {
            log.warn(e);
        }
        return;
    }
}