List of usage examples for org.apache.commons.logging Log isDebugEnabled
boolean isDebugEnabled();
From source file:com.thoughtworks.go.server.security.GoExceptionTranslationFilter.java
protected void sendStartAuthentication(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException reason) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; //TODO: This is a hack for bug #3175, we should revisit this code in V2.0 if (isJson(httpRequest) || isJsonFormat(httpRequest)) { httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return;//from www.j a v a 2s .c o m } final Log logger = LogFactory.getLog(GoExceptionTranslationFilter.class); SavedRequest savedRequest = new SavedRequest(httpRequest, getPortResolver()); if (logger.isDebugEnabled()) { logger.debug("Authentication entry point being called; SavedRequest added to Session: " + savedRequest); } if (isCreateSessionAllowed() && shouldRedirect(savedRequest.getRequestUrl())) { // Store the HTTP request itself. Used by AbstractProcessingFilter // for redirection after successful authentication (SEC-29) httpRequest.getSession().setAttribute(AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY, savedRequest); } // SEC-112: Clear the SecurityContextHolder's Authentication, as the // existing Authentication is no longer considered valid SecurityContextHolder.getContext().setAuthentication(null); determineAuthenticationPoint(httpRequest).commence(httpRequest, response, reason); }
From source file:mockit.integration.logging.LoggingIntegrationsTest.java
@Test public void commonsLoggingShouldLogNothing() { Log log1 = LogFactory.getLog("test"); Log log2 = LogFactory.getLog(LoggingIntegrationsTest.class); assertFalse(log1.isTraceEnabled());/*from ww w . j a v a 2s . co m*/ log1.error("testing that log does nothing"); assertFalse(log1.isDebugEnabled()); log2.trace("test"); log2.debug("testing that log does nothing"); }
From source file:gaderian.test.services.TestAssemblyInstruction.java
private void trainIsDebugEnabled(Log log) { expect(log.isDebugEnabled()).andReturn(false); }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the debug 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 ww w .j ava 2s. co m*/ public static Msg debug(Log log, String key, Object... varargs) { if (log.isDebugEnabled()) { Msg msg = Msg.createMsg(key, varargs); log.debug((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:de.ufinke.cubaja.sort.SortManager.java
public boolean isDebug() { final Log logger = this.logger; return logger != null && logger.isDebugEnabled(); }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the debug 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 *///www .ja v a2 s. co m public static Msg debug(Log log, Locale locale, String key, Object... varargs) { if (log.isDebugEnabled()) { Msg msg = Msg.createMsg(locale, key, varargs); log.debug((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 debug 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 *///w w w . j a v a 2s . c om public static Msg debug(Log log, Throwable throwable, String key, Object... varargs) { if (log.isDebugEnabled()) { Msg msg = Msg.createMsg(key, varargs); logDebugWithThrowable(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 debug 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. ja v a2s . c o m public static Msg debug(Log log, BundleBaseName basename, String key, Object... varargs) { if (log.isDebugEnabled()) { Msg msg = Msg.createMsg(basename, key, varargs); log.debug((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 debug 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 *//*from www. ja v a2s . com*/ public static Msg debug(Log log, Throwable throwable, Locale locale, String key, Object... varargs) { if (log.isDebugEnabled()) { Msg msg = Msg.createMsg(locale, key, varargs); logDebugWithThrowable(log, key, msg, throwable); return msg; } return null; }
From source file:net.sf.classifier4J.bayesian.WordProbability.java
private void calculateProbability() { // the logger can't be a field because this class might be serialized Log log = LogFactory.getLog(this.getClass()); String method = "calculateProbability() "; if (log.isDebugEnabled()) { log.debug(method + "START"); log.debug(method + "matchingCount = " + matchingCount); log.debug(method + "nonMatchingCount = " + nonMatchingCount); }/*from w ww . j a v a 2s . com*/ double result = IClassifier.NEUTRAL_PROBABILITY; if (matchingCount == 0) { if (nonMatchingCount == 0) { result = IClassifier.NEUTRAL_PROBABILITY; } else { result = IClassifier.LOWER_BOUND; } } else { result = BayesianClassifier .normaliseSignificance((double) matchingCount / (double) (matchingCount + nonMatchingCount)); } probability = result; if (log.isDebugEnabled()) { log.debug(method + "END Calculated [" + probability + "]"); } }