Package org.jeegen.jee6.util
Class LogUtil
- java.lang.Object
-
- org.jeegen.jee6.util.LogUtil
-
public class LogUtil extends Object
This class helps logging in a performant manner.
-
-
Constructor Summary
Constructors Constructor Description LogUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
banner(String key, String product)
This method builds a standard startup banner using the bundle name and the version string extracted from the resource bundle.static void
debug(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a debug message into a given log with given message objects.static void
error(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints an error message into a given log with given message objects.static String
format(String format, Object... arguments)
This method formats aString
using theMessageFormat.format(String, Object...)
method.static void
info(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints an info message into a given log with given message objects.static boolean
isEmpty(String input)
This method tests a givenString
if it is null or has zero length.static String
printf(String format, Object... arguments)
This method formats aString
using thePrintWriter.printf(String, Object...)
method.static void
trace(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a trace message into a given log with given message objects.static void
warn(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a warn message into a given log with given message objects.
-
-
-
Method Detail
-
printf
public static final String printf(String format, Object... arguments)
This method formats aString
using thePrintWriter.printf(String, Object...)
method.- Parameters:
format
- The formatString
.arguments
- The arguments to be formatted.- Returns:
- The completely formatted String.
-
trace
public static final void trace(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a trace message into a given log with given message objects. The message is formatted usingprintf(String, Object...)
with given objects. The formatting needs only be done if trace logging is enabled.- Parameters:
log
- TheLog
instance.format
- The formattable messaage.arguments
- The message objects formatted into the massage.
-
debug
public static final void debug(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a debug message into a given log with given message objects. The message is formatted usingprintf(String, Object...)
with given objects. The formatting needs only be done if debug logging is enabled.- Parameters:
log
- TheLog
instance.format
- The formattable messaage.arguments
- The message objects formatted into the massage.
-
info
public static final void info(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints an info message into a given log with given message objects. The message is formatted usingprintf(String, Object...)
with given objects. The formatting needs only be done if info logging is enabled.- Parameters:
log
- TheLog
instance.format
- The formattable messaage.arguments
- The message objects formatted into the massage.
-
warn
public static final void warn(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints a warn message into a given log with given message objects. The message is formatted usingprintf(String, Object...)
with given objects. The formatting needs only be done if warn logging is enabled.- Parameters:
log
- TheLog
instance.format
- The formattable messaage.arguments
- The message objects formatted into the massage.
-
error
public static final void error(org.apache.commons.logging.Log log, String format, Object... arguments)
This method prints an error message into a given log with given message objects. The message is formatted usingprintf(String, Object...)
with given objects. The formatting needs only be done if error logging is enabled.- Parameters:
log
- TheLog
instance.format
- The formattable messaage.arguments
- The message objects formatted into the massage.
-
format
public static final String format(String format, Object... arguments)
This method formats aString
using theMessageFormat.format(String, Object...)
method.- Parameters:
format
- The formatString
.arguments
- The arguments to be formatted.- Returns:
- The completely formatted String.
-
isEmpty
public static final boolean isEmpty(String input)
This method tests a givenString
if it is null or has zero length.- Parameters:
input
- TheString
object to test.- Returns:
- true if given text is null or has zero length.
-
banner
public static String banner(String key, String product)
This method builds a standard startup banner using the bundle name and the version string extracted from the resource bundle.- Parameters:
key
- The resource bundle key to use.product
- The product name.- Returns:
- The banner string to display.
-
-