[SOLVED] Migrating binding to new development environment: org.slf4j errors

So, I am a rookie in the process of migrating a binding into the new development environment, successfully following @hilbrand tutorial (using Eclipse IDE):


However, as I run the mvn clean install, I get several errors pointing to a common issue throughout the code (not having issues in previous development environment):

[ERROR] org.openhab.binding.<MyBinding>.<MyJava.java>:[105]
Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance

All problems relate to logger.debug, showing an example code below:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final Logger logger = LoggerFactory.getLogger(My.class);

The error then points to the logger.debug(device.toString());

Any guidance/tips would be appreciated. I also see similar use of logger.debug from other bindings.

Usa placeholders in all loglines, as suggested.
For example:

logger.debug("Device {}", device.toString());

As an additional comment. Leave out the toString. The logger will call toString itself. And by not using toString() the toString method is only called when debug level is enabled. When using the device.toString() the toString is always performed even when debug level is not enabled.

logger.debug("Device {}", device);

Quite an easy fix…

Appreciate your guidance!