[slf4j-user] Small bug in SLF4JBridgeHandler ?
niels
opensource21 at gmail.com
Fri Jan 11 09:57:18 CET 2013
It definitely unnecessary code, so I think a bug-report is a good idea.
2013/1/10 Maarten Bosteels <mbosteels.dns at gmail.com>
> Hello,
>
>
> https://github.com/qos-ch/slf4j/blob/master/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java#L283
>
>
>
> public void publish(LogRecord record) {
> // Silently ignore null records.
> if (record == null) {
> return;
> }
>
>
> Logger slf4jLogger = getSLF4JLogger(record);
> String message = record.getMessage(); // can be null!
> // this is a check to avoid calling the underlying logging system
> // with a null message. While it is legitimate to invoke j.u.l. with
> // a null message, other logging frameworks do not support this.
> // see also http://bugzilla.slf4j.org/show_bug.cgi?id=108
> if (message == null) {
> message = "";
> }
> if (slf4jLogger instanceof LocationAwareLogger) {
> callLocationAwareLogger((LocationAwareLogger) slf4jLogger, record);
> } else {
> callPlainSLF4JLogger(slf4jLogger, record);
> }
> }
>
>
> I don't understand the point of changing the local variable message to the empty string since that local variable is not used afterwards.
> Shouldn't this be like this :
>
> if (message == null) {
> record.setMessage("");
> }
>
> Should a file a bug ?
>
>
> Best regards
> Maarten
>
>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20130111/6631461f/attachment.html>
More information about the slf4j-user
mailing list