JAPI Guide: Logging
JAPI Logging
JAPI comes with a Logging API on its own.
Why yet another Logging API?
During the development of Gridarta, we merged two programs, one was using Log4J, the other
was using java.util.logging
for Logging.
Both Logging APIs have its strengths and its weaknesses.
Yet none of them fulfilled my personal demands for an easy logging API:
- Easy to use
When speaking of Easy to use, I mean that the interface should be clean, no matter what kind of logging I perform. I derive the following requirements from Easy to use:
- Easy for i18n/l10n.
- Transparent use of
java.util.Formatter
orjava.text.MessageFormat
. - Varargs interface for passing the formatting arguments to the used formatter (see previous point).
- Fast decision whether or not to log something to reduce the number of
if (log.isEnabled(level))
statements in Code.
To fulfill more demands of other developers, I also added the following requirements to the list:
- Redirectable to Log4J
- Redirectable to
java.util.logging
Further notes on this Logging API
I do not claim that this Logging API is the best of all.
I do not even claim that this Logging API is better than Log4J or java.util.logging
in general.
I only claim that for my personal demands and my personal way of using Logging in Java, my Logging API fits better than those that I know.
But of course I would be glad if others find my Logging API just as useful as I do.