'I want to enable logging before running
How can I use Spring boot's logging system before running SpringApplication::run
?
By the way, I'm using logback and lombok.
@slf4j
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
log.info("Start application."); // I want to output this log with the same log system as the Spring boot application.
SpringApplication application = new SpringApplication(MyApplication.class);
application.setBannerMode(Banner.Mode.OFF);
application.run(args);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|