初始化Slf4j LoggerFactory.getLogger的正确方法是什么?我的代码中有
What is the correct way to initialize Slf4j LoggerFactory.getLogger? I have in my code
static final Logger logger = LoggerFactory.getLogger(MyClass.class);
但 sonarqube 代码分析将此代码标记为重大错误:"重命名此常量名称以匹配正则表达式'^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'"
But sonarqube code analysis marks this code as major error: "Rename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'"
怎么了?
常量(静态final)变量在Java中一般都是大写的.所以你可以:
Constants (static final) variables are generally in upper case in Java. So you can either:
logger
重命名为其他名称,例如 LOG
logger
into something else, for example LOG
这篇关于Slf4j LoggerFactory.getLogger 和 sonarqube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!