Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FAQ

How do I configure SLF4J?

To configure SLF$J 

  1. Add a log4j-test.properties under the directory of the java test

...

  1. .

  2. Add the following snippets into your build.gradle file.


    Code Block
    test {

...

  1. 
    systemProperty "log4j.configuration", "log4j-test.properties"

...

  1. 
    }

...

  1. 
    
    dependencies {

...

  1. 
    shadow library.java.slf4j_api

...

  1. 
    shadow library.java.slf4j_log4j12

...

  1. 
    // or shadow library.java.slf4j_jdk14

...

  1. 
    }


  2. The second

...

  1. dependency shadow library.java.slf4j_

...

  1. log4j12 is not necessary if another library already provides this dependency

...

  1. .
  2. Check the dependency included in the dependency tree

...

  1. , execute:

    Code Block
    ./gradlew dependencies

...

  1. .


  2. Check If you encounter

...

  1. an error message like

...

  1. the following.

    Panel
    borderStyledashed

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation

...


    1. If so, it means there is no SLF4J

...

    1. .
    2. Add library.java.slf4j_log4j12 or library.java.slf4j_jdk14 in

...

    1. the file.


How

...

to format code automatically and avoid spotless errors?

You can set up a git precommit hook to always autoformat code, by putting this in .git/hooks/pre-commit and setting the executable bit.

...