[slf4j-dev] Benefits of Message objects?

Ceki Gulcu ceki at qos.ch
Sat Sep 10 15:53:00 CEST 2011


On 07.09.2011 21:47, Joern Huxhorn wrote:
> Ok, huge post is incoming... ;)
>
> To properly explain the reason for Message I should start with my redefinition of the Logger interfaces.
>
> ## core.BasicLogger
>
> I created a BasicLogger interface ( https://github.com/huxi/slf4j/blob/slf4j-redesign/slf4j-n-api/src/main/java/org/slf4j/core/BasicLogger.java ) that merely defines the following methods:
> 	boolean isEnabled(T level);
> 	void log(T level, Message message);
> 	void log(T level, Message message, Throwable throwable);
>
> As you can see, Message is already used in this interface. The idea is that several different
> Logger systems can be created extending it, e.g. Classic, Access or your Audit logger.

Access does not have use for Level nor Throwable. Audit has no use for
Level.  Logback-audit has quite a different API than
logback-classic. For example, exceptions thrown during audit logging
are rethrown to the user as AuditExceptions. It is not obvious that
merging developer (classic) logging, access logging and audit logging
into a single API makes sense.

Cheers,
-- 
QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software engineers. For further details, see 
http://logback.qos.ch/job.html


More information about the slf4j-dev mailing list