diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java index bdbd00e6099..0acf4e369f0 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/AbstractLogger.java @@ -75,4 +75,10 @@ public abstract class AbstractLogger implements Logger } return true; } + + public void debug(String msg, long arg) + { + if (isDebugEnabled()) + debug(msg,new Long(arg)); + } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java index d01305f6269..c9047bc4b7d 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java @@ -111,6 +111,12 @@ public class JavaUtilLog extends AbstractLogger _logger.log(Level.FINE,format(msg, args)); } + public void debug(String msg, long arg) + { + if (_logger.isLoggable(Level.FINE)) + _logger.log(Level.FINE,format(msg, arg)); + } + public void debug(Throwable thrown) { debug("", thrown); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Logger.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Logger.java index afe405cc710..a6a1647c727 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Logger.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Logger.java @@ -85,6 +85,15 @@ public interface Logger * @param args the optional arguments */ public void debug(String msg, Object... args); + + + /** + * Formats and logs at debug level. + * avoids autoboxing of integers + * @param msg the formatting string + * @param args the optional arguments + */ + public void debug(String msg, long value); /** * Logs the given Throwable information at debug level diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java index 7909ced4133..5747b46ec62 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/LoggerLog.java @@ -151,6 +151,7 @@ public class LoggerLog extends AbstractLogger } } + public void debug(String msg, Object... args) { if (!_debug) @@ -186,6 +187,21 @@ public class LoggerLog extends AbstractLogger } } + public void debug(String msg, long value) + { + if (!_debug) + return; + + try + { + _debugMAA.invoke(_logger, new Object[]{new Long(value)}); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + public void ignore(Throwable ignored) { if (Log.isIgnored()) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java index d9ebd177b2d..3c944d6e7be 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Slf4jLog.java @@ -88,6 +88,12 @@ public class Slf4jLog extends AbstractLogger { _logger.debug(msg, args); } + + public void debug(String msg, long arg) + { + if (isDebugEnabled()) + _logger.debug(msg, new Object[]{new Long(arg)}); + } public void debug(Throwable thrown) { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java index 1439b8af66a..4488480ab9b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java @@ -519,6 +519,16 @@ public class StdErrLog extends AbstractLogger } } + public void debug(String msg, long arg) + { + if (isDebugEnabled()) + { + StringBuilder buffer = new StringBuilder(64); + format(buffer,":DBUG:",msg,arg); + (_stderr==null?System.err:_stderr).println(buffer); + } + } + public void debug(Throwable thrown) { debug("",thrown);