List of usage examples for org.apache.commons.logging Log isDebugEnabled
boolean isDebugEnabled();
From source file:kr.co.aim.nanoframe.orm.SQLLogUtil.java
public static String getLogFormatSqlStatement(String sql, Object args, Log log) { try {/* w w w .j a va 2 s . c o m*/ if (args instanceof Map) { Map<String, Object> map = (Map<String, Object>) args; TreeMap<String, Object> treeMap = new TreeMap<String, Object>(stringComparator); treeMap.putAll(map); Iterator<Entry<String, Object>> iter = treeMap.entrySet().iterator(); while (iter.hasNext()) { Entry<String, Object> entry = iter.next(); sql = sql.replace(":" + entry.getKey(), getLogFormatArgument(entry.getValue())); } } else if (args instanceof Object[]) { Object[] objs = (Object[]) args; for (Object obj : objs) { sql = StringUtils.replaceOnce(sql, "?", getLogFormatArgument(obj)); } } } catch (Throwable t) { if (log.isDebugEnabled()) log.error(t, t); else log.error(t); } return sql; }
From source file:de.daibutsu.main.MainStart.java
private void starteAnwendung() { Log log = LogFactory.getLog(MainStart.class); if (log.isDebugEnabled()) { log.debug("Starte Anwendung."); }/*from ww w.j a v a 2 s .co m*/ new MainTray(); }
From source file:com.runwaysdk.format.ParseException.java
/** * Logs an exception when a parse error occurs. Because parse errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. *///from w w w .j av a2s .c om @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when parsing [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getValue(), this.getLocale()); log.debug(message, this); } }
From source file:com.runwaysdk.format.FormatException.java
/** * Logs an exception when a format error occurs. Because format errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. *///from w w w . java 2 s. c om @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when formatting [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getObject(), this.getLocale()); log.debug(message, this); } }
From source file:com.microsoft.tfs.client.common.ui.framework.console.ConsoleStream.java
private void printConsoleMessage(final String message, final boolean newline) { final Log log = console.getLog(); if (log.isDebugEnabled()) { final String messageFormat = "[{0}]: {1}"; //$NON-NLS-1$ final String text = MessageFormat.format(messageFormat, id, message); log.debug(text);/*from w ww .j a v a 2 s.c o m*/ } if (!console.isEnabled()) { return; } console.throwIfDisposed(); /* * println() and print() can be called from any thread */ if (newline) { stream.println(message); } else { stream.print(message); } }
From source file:de.iteratec.iteraplan.businesslogic.common.AuditLogger.java
/** * Checks whether the log level is sufficiently high, in this case DEBUG or higher. * Must be override here, because the base class even requires TRACE level, * while iteraplan configuration convention is to demand DEBUG level logging. *//*from ww w. j a va 2 s . c o m*/ @Override protected boolean isLogEnabled(Log logger) { return logger.isDebugEnabled(); }
From source file:com.runwaysdk.format.DisplayException.java
/** * Logs an exception when a display error occurs. Because display errors * are a normal part of handling user input, this will only log at the * DEBUG level to avoid flooding the logs. *//*w w w . ja v a2 s . co m*/ @Override protected void logException() { Log log = this.getLog(); if (log.isDebugEnabled()) { String template = "Error in [%s] when displaying [%s] with locale [%s]."; String message = String.format(template, this.getFormat(), this.getObject(), this.getLocale()); log.debug(message, this); } }
From source file:name.chenyuelin.aopAdvisor.DebugLoggerAdvisor.java
@Override public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { if (LOG.isDebugEnabled()) { Log log = getLog(target); if (log != null && log.isDebugEnabled()) { StringBuilder debugMessage = new StringBuilder(50); debugMessage.append(method.getName()).append(" end.\nReturns:{"); if (returnValue == null) { debugMessage.append(returnValue).append("}"); } else { debugMessage.append(returnValue.getClass().getSimpleName()).append(":").append(returnValue) .append("}"); }/*w ww . j a v a 2 s . com*/ log.debug(debugMessage); } } }
From source file:name.chenyuelin.aopAdvisor.DebugLoggerAdvisor.java
@Override public void before(Method method, Object[] args, Object target) throws Throwable { if (LOG.isDebugEnabled()) { Log log = getLog(target); if (log != null && log.isDebugEnabled()) { StringBuilder debugMessage = new StringBuilder(50); debugMessage.append(method.getName()).append(" start.\nParameters:\n"); for (Object arg : args) { Class<?> argClass = arg.getClass(); debugMessage.append(argClass.getSimpleName()).append(":").append(arg).append("\n"); }//from w ww .j av a 2 s. co m if (debugMessage.length() > 0) { debugMessage.deleteCharAt(debugMessage.length() - 1); } log.debug(debugMessage); } } }
From source file:net.sf.nmedit.jtheme.component.misc.CallDescriptor.java
public void call() { JTComponent t = getTarget();/*ww w. j a v a 2 s . com*/ if (t == null) return; Method m = getMethod(t); if (m == null) return; try { m.invoke(t, new Object[0]); } catch (Exception e) { Log l = LogFactory.getLog(getClass()); if (l.isDebugEnabled()) l.debug("call failed on method: " + method, e); } }