The primary motivation is that I use SEQ for logging, but I couldn't find a quick complete guide to use SEQ with java spring boot using gradle. So here I'm documenting my findings.
repositories { ... maven { url 'https://jitpack.io' } } dependencies { ... implementation 'com.github.serilogj:serilogj:v0.6.1' }
// import serilogj.Log; // import serilogj.LoggerConfiguration; // import serilogj.events.LogEventLevel; // import static serilogj.sinks.seq.SeqSinkConfigurator.seq; // setting up the logger Log.setLogger(new LoggerConfiguration() .writeTo(seq("http://localhost:5341/")) .setMinimumLevel(LogEventLevel.Verbose) .createLogger()); // using the logger var logger = Log.getLogger().forContext(SpringApplication.class); logger.information("Hello World");
With this setup the logger should work
You can find the code here
The above is the detailed content of Java Spring Boot use Seq for logging. For more information, please follow other related articles on the PHP Chinese website!