research-virtualfortknox / msb-client-websocket-java

The java client library to connect to the websocket interface of the MSB (Manufacturing Service Bus)
Apache License 2.0
5 stars 3 forks source link

No log output on plain java applications #26

Closed ipa-big closed 4 years ago

ipa-big commented 4 years ago

Describe the bug The MSB Client does not show any console log output if the application is a plain java application. If you add @SpringBootApplication and spring dependencies to pom.xml the output works.

Console is showing SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

To Reproduce Dependencies of pom.xml of plain java app:

<dependencies>
         <dependency>
            <groupId>com.github.research-virtualfortknox</groupId>
            <artifactId>msb-client-websocket</artifactId>
            <version>1.0.2-RELEASE</version>
        </dependency>
</dependencies>

Dependencies of spring app:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.research-virtualfortknox</groupId>
            <artifactId>msb-client-websocket</artifactId>
            <version>1.0.2-RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.29</version>
        </dependency>
</dependencies>

Expected behavior MSB Client should print logs to console if used in plain java applications.

Environment (please complete the following information):

daniel-schel commented 4 years ago

Logging is implemented with SLF4J (Simple Logging Facade for Java), which allows you to use a logging framework of your choice. I have added logging to the README and added a corresponding example for the use of logback.