List of usage examples for org.apache.commons.logging Log warn
void warn(Object message);
From source file:name.chenyuelin.aopAdvisor.DebugLoggerAdvisor.java
private Log getLog(Object target) throws IllegalArgumentException, SecurityException, IllegalAccessException { Class<?> targetClass = target.getClass(); Log log = logMap.get(targetClass); if (log == null) { try {//w ww . jav a2s.c om log = (Log) targetClass.getField(LOG_NAME).get(null); logMap.put(targetClass, log); } catch (NoSuchFieldException e) { LOG.warn(e); return null; } catch (IllegalArgumentException e) { throw e; } catch (SecurityException e) { throw e; } catch (IllegalAccessException e) { throw e; } } return log; }
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; }/*from ww w . j av a2s. co m*/ return image; }
From source file:interactivespaces.workbench.project.java.BndOsgiContainerBundleCreator.java
/** * Output warnings for the user./*from w w w . j a v a 2s. c o m*/ * * @param issues * the issues * @param log * the logger to use */ private void outputWarnings(List<String> issues, Log log) { for (String issue : issues) { log.warn("OSGi Bundle Creator: " + issue); } }
From source file:net.mikaboshi.intra_mart.tools.log_stats.parser.LineLogParser.java
/** * WARN??//from ww w.j a v a 2 s . co 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: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)); }/*from w ww . jav a 2 s . c o m*/ return delegate.noComponentFound(container, key); }
From source file:eu.semaine.jms.JMSLogReader.java
@Override public void onMessage(Message m) { try {//from www. ja v a 2 s. co m if (!(m instanceof TextMessage)) { return; // silently ignore } String dest = m.getJMSDestination().toString(); // dest is expected to have the form // semaine.log.component.log-level String[] parts = dest.split("\\."); String level = parts[parts.length - 1].toLowerCase(); String component = parts[parts.length - 2]; Log log = LogFactory.getLog("semaine.log." + component); String text = ((TextMessage) m).getText(); //text = time.format(new Date(m.getJMSTimestamp())) + " " + text; if (level.equals("info")) log.info(text); else if (level.equals("warn")) log.warn(text); else if (level.equals("error")) log.error(text); else if (level.equals("debug")) log.debug(text); else log.info(text); } catch (Exception e) { } }
From source file:com.tecapro.inventory.common.util.LogUtil.java
/** * /*from w w w .j a v a 2 s. c o m*/ * Warn log output * * @param log * @param clazz * @param method * @param time */ public void warnLog(Log log, String clazz, String method, InfoValue info, Throwable e) { log.warn(returnLogString(clazz, method, info, LogPrefix.OTHER, e)); log.warn(e.getMessage(), e); }
From source file:com.tecapro.inventory.common.util.LogUtil.java
/** * /*from ww w . ja v a 2 s . c om*/ * Warn log output * * @param log * @param clazz * @param method * @param time */ public void warnLog(Log log, String clazz, String method, InfoValue info, String message) { log.warn(returnLogString(clazz, method, info, LogPrefix.OTHER, message)); }
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 w w . j a v a 2 s .co 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 w w.j a v a 2 s.c o m 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; }