Skip to content

Logging

mpfotenhauer edited this page Dec 5, 2017 · 13 revisions

We added logging support via Simple Logging Facade for Java (SLF4J). Doing so everybody is able to configure a logging framework.

In the Neodymium-example we demonstrate how to use Apache Log4j 2 as a logging framework.

Setup and usage

  1. Add a Logger of your choice to your pom.xml

     <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-slf4j-impl</artifactId>
         <version>2.10.0</version>
         <scope>test</scope>
     </dependency>
    

    If you don't want to use logging and don't want to be bothered about it on the console you can add a no operation implementation of the logger.

     <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-nop</artifactId>
         <version>1.7.25</version>
         <scope>test</scope>
     </dependency>
    
  2. Add a configuration

    • Log4j 2 requires a configuration this can be done in various ways.
    • We added a demo config src/test/resources/log4j2.properties.
    • Pitfall: Make sure that the properties.projectPath within the properties file is matching you project structure.
Clone this wiki locally