I'm developing an application using Azure's Java SDK and Maven. This application sends data to an IoT Hub and some other functionalities that are not important for the scope of the question.
I implemented my own logging inside the application by using log4j2
and I'm fine with that since I can modify and change it however I want.
The problem arose when I checked this warning that was coming up in my application's console output:
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.
Thanks to this SO question I was able to do the correct move and add the dependency inside my pom.xml
file like so:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.project.myProject</groupId>
<artifactId>myProject</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
...
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
</dependency>
...
After this addition the Azure's SDK started printing to console a lot of information that I don't really want to see. This should be the class that originates the logging.
Following, some output that gets written to console by itself.
...
Jun 07, 2018 8:09:18 PM com.microsoft.azure.sdk.iot.device.CustomLogger LogInfo
INFO: IotHubConnectionString object is created successfully for iotHub.azure-devices.net, method name is <init>
Jun 07, 2018 8:09:19 PM com.microsoft.azure.sdk.iot.device.CustomLogger LogInfo
INFO: DeviceClientConfig object is created successfully with IotHubName=iotHub.azure-devices.net, deviceID=device01 , method name is <init>
Jun 07, 2018 8:09:20 PM com.microsoft.azure.sdk.iot.device.CustomLogger LogInfo
INFO: DeviceIO object is created successfully, method name is <init>
Jun 07, 2018 8:09:20 PM com.microsoft.azure.sdk.iot.device.CustomLogger LogInfo
INFO: Setting SASTokenExpiryTime as 2400 seconds, method name is setOption_SetSASTokenExpiryTime
...
I've already tried to disable the Logger
but with no success (followed this SO question).
I would like to know if someone has ever had this problem and if so how can I disable the logging features or else suppress the warning?
Thanks a lot in advance!