Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Java Spring Boot use Seq for logging
Minhaz
Minhaz

Posted on

     

Java Spring Boot use Seq for logging

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.

Steps

I'm using this configuration for the project

Project setup

Add these tobuild.gradle for dependency

repositories {    ...    maven { url 'https://jitpack.io' }}dependencies {    ...    implementation 'com.github.serilogj:serilogj:v0.6.1'}
Enter fullscreen modeExit fullscreen mode

Now just configure the logger

// import serilogj.Log;// import serilogj.LoggerConfiguration;// import serilogj.events.LogEventLevel;// import static serilogj.sinks.seq.SeqSinkConfigurator.seq;// setting up the loggerLog.setLogger(new LoggerConfiguration()        .writeTo(seq("http://localhost:5341/"))        .setMinimumLevel(LogEventLevel.Verbose)        .createLogger());// using the loggervar logger = Log.getLogger().forContext(SpringApplication.class);logger.information("Hello World");
Enter fullscreen modeExit fullscreen mode

With this setup the logger should work

SEQ Working

You can find the codehere

Reference

  1. https://docs.datalust.co/docs/using-java
  2. My blog
  3. Source Code

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I love tinkering with things and trying out any idea I get.
  • Location
    Bangladesh
  • Joined

More fromMinhaz

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp