java.lang.String cannot be converted to org.slf4j.Marker

谁说胖子不能爱 提交于 2019-12-10 16:35:36

问题


I'm using import lombok.extern.slf4j.Slf4j; for my class, and here's my log statement:log.info("{} : {} - {}", String1, String2, String3);

But it fails to compile and complaining the above line:java.lang.String cannot be converted to org.slf4j.Marker

Any ideas please?


回答1:


I guess that you are willing to use info(String format, Object... arguments) and are wondering why the method that is really called is info(Marker marker, String format, Object arg1, Object arg2).

This is related to Most Specific Method selection and Identify Potentially Applicable Methods.

As you have exactly four parameters, out of which three matches perfectly, the info(Marker marker, String format, Object arg1, Object arg2) method must be considered as "potentially matching".

You should read the documentation about variable arity parameters to get more details.



来源:https://stackoverflow.com/questions/41880719/java-lang-string-cannot-be-converted-to-org-slf4j-marker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!