List of usage examples for org.apache.commons.logging Log isWarnEnabled
boolean isWarnEnabled();
From source file:org.apache.http.HC4.conn.util.PublicSuffixMatcherLoader.java
public static PublicSuffixMatcher getDefault() { if (DEFAULT_INSTANCE == null) { synchronized (PublicSuffixMatcherLoader.class) { if (DEFAULT_INSTANCE == null) { final URL url = PublicSuffixMatcherLoader.class.getResource("mozilla/public-suffix-list.txt"); if (url != null) { try { DEFAULT_INSTANCE = load(url); } catch (IOException ex) { // Should never happen final Log log = LogFactory.getLog(PublicSuffixMatcherLoader.class); if (log.isWarnEnabled()) { log.warn("Failure loading public suffix list from default resource", ex); }/*from w ww . ja v a 2 s . c om*/ } } else { DEFAULT_INSTANCE = new PublicSuffixMatcher(Arrays.asList("com"), null); } } } } return DEFAULT_INSTANCE; }
From source file:org.apache.http.HC4.nio.conn.ssl.SSLIOSessionStrategy.java
private static PublicSuffixMatcher getDefaultPublicSuffixMatcher() { if (DEFAULT_INSTANCE == null) { synchronized (PublicSuffixMatcherLoader.class) { if (DEFAULT_INSTANCE == null) { final URL url = PublicSuffixMatcherLoader.class.getResource("/mozilla/public-suffix-list.txt"); if (url != null) { try { DEFAULT_INSTANCE = PublicSuffixMatcherLoader.load(url); } catch (IOException ex) { // Should never happen final Log log = LogFactory.getLog(PublicSuffixMatcherLoader.class); if (log.isWarnEnabled()) { log.warn("Failure loading public suffix list from default resource", ex); }//from ww w . ja v a2 s .com } } else { DEFAULT_INSTANCE = new PublicSuffixMatcher(Arrays.asList("com"), null); } } } } return DEFAULT_INSTANCE; }
From source file:org.apache.jsieve.tests.AbstractTest.java
/** * Framework method validateArguments is invoked before a Sieve Test is * executed to validate its arguments. Subclass methods are expected to * override or extend this method to perform their own validation as * appropriate./*from ww w.j av a 2s . c o m*/ * * @param arguments * @param context * <code>SieveContext</code> giving comntextual information, * not null * @throws SieveException */ protected void validateArguments(Arguments arguments, SieveContext context) throws SieveException { if (!arguments.getArgumentList().isEmpty()) { final Log logger = context.getLog(); if (logger.isWarnEnabled()) { logger.warn("Unexpected arguments for " + getClass().getName()); } context.getCoordinate().logDiagnosticsInfo(logger); logger.debug(arguments); final String message = context.getCoordinate().addStartLineAndColumn("Found unexpected arguments."); throw new SyntaxException(message); } }
From source file:org.apache.ojb.broker.util.logging.CommonsLoggerImpl.java
/** * @see org.apache.ojb.broker.util.logging.Logger#isEnabledFor(int) */// w w w .ja v a 2 s . c o m public boolean isEnabledFor(int priority) { Log commonsLog = getLog(); switch (priority) { case Logger.DEBUG: return commonsLog.isDebugEnabled(); case Logger.INFO: return commonsLog.isInfoEnabled(); case Logger.WARN: return commonsLog.isWarnEnabled(); case Logger.ERROR: return commonsLog.isErrorEnabled(); case Logger.FATAL: return commonsLog.isFatalEnabled(); } return false; }
From source file:org.easyrec.utils.spring.log.LoggerUtils.java
/** * @param logger/*from ww w.ja v a 2 s. c om*/ * @param logLevel * */ public static boolean isLogLevelEnabled(Log logger, String logLevel) { if (logLevel.equalsIgnoreCase("info")) { if (logger.isInfoEnabled()) { return true; } } else if (logLevel.equalsIgnoreCase("debug")) { if (logger.isDebugEnabled()) { return true; } } else if (logLevel.equalsIgnoreCase("error")) { if (logger.isErrorEnabled()) { return true; } } else if (logLevel.equalsIgnoreCase("trace")) { if (logger.isTraceEnabled()) { return true; } } else if (logLevel.equalsIgnoreCase("warn")) { if (logger.isWarnEnabled()) { return true; } } else if (logLevel.equalsIgnoreCase("fatal")) { if (logger.isFatalEnabled()) { return true; } } else { logger.warn("Passed unknown log level '" + logLevel + "' to Aspect - returning false!"); return false; } logger.warn("log level '" + logLevel + "' not enabled - returning false!"); return false; }
From source file:org.easyrec.utils.spring.log.LoggerUtils.java
/** * Writes the given 'message' to the Log 'logger' with level 'logLevel'. * * @param logger the Log to which the message is written * @param logLevel the level to which the message is written * @param message the message to be written *//*from w w w . j a v a2 s . c o m*/ public static void log(Log logger, String logLevel, String message) { if (logLevel.equalsIgnoreCase("info")) { if (logger.isInfoEnabled()) { logger.info(message); } } else if (logLevel.equalsIgnoreCase("debug")) { if (logger.isDebugEnabled()) { logger.debug(message); } } else if (logLevel.equalsIgnoreCase("error")) { if (logger.isErrorEnabled()) { logger.error(message); } } else if (logLevel.equalsIgnoreCase("trace")) { if (logger.isTraceEnabled()) { logger.trace(message); } } else if (logLevel.equalsIgnoreCase("warn")) { if (logger.isWarnEnabled()) { logger.warn(message); } } else if (logLevel.equalsIgnoreCase("fatal")) { if (logger.isFatalEnabled()) { logger.fatal(message); } } else { logger.error("Passed unknown log level " + logLevel + " to Aspect - logging to error instead!"); logger.error(message); } }
From source file:org.easyrec.utils.spring.log.LoggerUtils.java
/** * Writes the given 'message' to the Log 'logger' with level 'logLevel'. * * @param logger the Log to which the message is written * @param logLevel the level to which the message is written * @param message the message to be written * @param ta a Throwable passed on to the Log *//*from w w w.j a v a 2 s .c om*/ public static void log(Log logger, String logLevel, String message, Throwable ta) { if (logLevel.equalsIgnoreCase("info")) { if (logger.isInfoEnabled()) { logger.info(message, ta); } } else if (logLevel.equalsIgnoreCase("debug")) { if (logger.isDebugEnabled()) { logger.debug(message, ta); } } else if (logLevel.equalsIgnoreCase("error")) { if (logger.isErrorEnabled()) { logger.error(message, ta); } } else if (logLevel.equalsIgnoreCase("trace")) { if (logger.isTraceEnabled()) { logger.trace(message, ta); } } else if (logLevel.equalsIgnoreCase("warn")) { if (logger.isWarnEnabled()) { logger.warn(message, ta); } } else if (logLevel.equalsIgnoreCase("fatal")) { if (logger.isFatalEnabled()) { logger.fatal(message, ta); } } else { logger.error("Passed unknown log level " + logLevel + " to Aspect - logging to error instead!"); logger.error(message, ta); } }
From source file:org.eclipse.smila.search.datadictionary.DataDictionaryAccess.java
/** * DataDicitonaryAccess.// w w w .jav a2s .c o m * * @return - an access object. */ public static DataDictionaryAccess getInstance() { final Log log = LogFactory.getLog(DataDictionaryAccess.class); DataDictionaryAccess[] types; try { types = getTypes(); if (types.length != 1) { if (log.isWarnEnabled()) { log.warn("invalid data dictionary access count [" + types.length + "]"); } return null; } return types[0]; } catch (final DataDictionaryException e) { if (log.isErrorEnabled()) { log.error(e); } return null; } }
From source file:org.eclipse.smila.search.plugin.PluginFactory.java
public static Plugin getInstance() { // TODO: implement correctly final Log log = LogFactory.getLog(PluginFactory.class); Plugin[] types;/*from w w w .j ava2 s .c o m*/ try { types = getTypes(); if (types.length != 1) { if (log.isWarnEnabled()) { log.warn("invalid plugin count [" + types.length + "]"); } return null; } return types[0]; } catch (final PluginException e) { if (log.isErrorEnabled()) { log.error(e); } return null; } }
From source file:org.eclipse.smila.search.utils.advsearch.AdvSearchAccess.java
public static AdvSearchAccess getInstance() { final Log log = LogFactory.getLog(AdvSearchAccess.class); AdvSearchAccess[] types;/* ww w .j a v a2s. com*/ try { types = getTypes(); if (types.length != 1) { if (log.isWarnEnabled()) { log.warn("invalid index structure access count [" + types.length + "]"); } return null; } return types[0]; } catch (final AdvSearchException e) { if (log.isErrorEnabled()) { log.error(e); } return null; } }