Java SLF4J警告-记录器将无法工作,因为它们是在初始化阶段创建的
我正在dropwizard应用程序中使用带有logback的slf4j。在应用程序初始化期间,我看到如下日志Java SLF4J警告-记录器将无法工作,因为它们是在初始化阶段创建的,java,logback,slf4j,dropwizard,Java,Logback,Slf4j,Dropwizard,我正在dropwizard应用程序中使用带有logback的slf4j。在应用程序初始化期间,我看到如下日志 SLF4J: The following loggers will not work because they were created SLF4J: during the default configuration phase of the underlying logging system. SLF4J: See also http://www.slf4j.org/codes.htm
SLF4J: The following loggers will not work because they were created
SLF4J: during the default configuration phase of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#substituteLogger
SLF4J: com.vnera.healthandmetrics.VneraMetrics
public class VneraMetrics {
private static final Logger logger = LoggerFactory.getLogger(VneraMetrics.class);
...
// This method is getting called from Service.run() during the dropwizard application initialization
public String getSomeValue() {
// logger is not accessed from this function
return "Some initialized value";
}
}
public class Service extends Application<Conf> {
public static final Logger logger = LoggerFactory.getLogger(Service.class);
public static void main(String args[]) {
logger.info("Some logs");
Service service = new Service();
service.run(dropWizardArgs);
Utils.reloadLogger();
}
}
我正在dropwizard应用程序中使用logback.xml
。我的代码流如下所示
SLF4J: The following loggers will not work because they were created
SLF4J: during the default configuration phase of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#substituteLogger
SLF4J: com.vnera.healthandmetrics.VneraMetrics
public class VneraMetrics {
private static final Logger logger = LoggerFactory.getLogger(VneraMetrics.class);
...
// This method is getting called from Service.run() during the dropwizard application initialization
public String getSomeValue() {
// logger is not accessed from this function
return "Some initialized value";
}
}
public class Service extends Application<Conf> {
public static final Logger logger = LoggerFactory.getLogger(Service.class);
public static void main(String args[]) {
logger.info("Some logs");
Service service = new Service();
service.run(dropWizardArgs);
Utils.reloadLogger();
}
}
版本
- 回写-1.2.3
- Dropwizard-1.0.2
VneraMetrics
中使用记录器时,它不会打印任何内容