本文介绍了slf4j是否有Java 1.5 varargs API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想摆脱很多...

public void info(String msg);
public void info(String format, Object arg);
public void info(String format, Object arg1, Object arg2);
public void info(String format, Object[] argArray);

...然后用这个替换它...

...and replace it with this one...

public void info(String format, Object ... args);

...以便我的日志记录语法不必根据我要记录的参数数量而更改.似乎有很多讨论和解决方案,但是它在哪里?还是应该包装slf4j的包装纸?

...so that my logging syntax doesn't have to change depending on the number of arguments I want to log. There seems to be lots of discussion and work around it, but where is it? Or should I wrap the wrapper that is slf4j?

推荐答案

真正的问题是为什么jdk< 5不再受此支持"?如果您有Java的旧版本,请使用旧的API.就这么简单.为什么不让它更好地适应当前的Java世界呢?我的意思是,没有Sun/Oracle的支持合同,甚至不支持JDK 5.在这种情况下,向后兼容是一个笑话.

The real question is "Why must a jdk < 5 be supported by this any longer"? If you have an older version of java, then use the older API. It's that simple. Why not make this fit better into the current java world? I mean, JDK 5 isn't even supported without a support contract from Sun/Oracle. Backward compatibility is a joke in this case.

这篇关于slf4j是否有Java 1.5 varargs API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 03:48