private static final Logger LOGGER = LoggerFactory.getLogger(Updater.class);
I am using SLF4J
and Logback
When I try to log statements
LOGGER.info("{}:{}:{}", one, two, three)
it says
cannot find symbol method info(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
Is there not any way I can log more than two variables in a single info
statement?
You must upgrade SLF4J to 1.7 which includes Logger.info(java.lang.String, java.lang.Object...)
varargs method. See Bug 31 - Varargs for Logger methods fixed after six years worth of discussion.
Prior to 1.7 you must surround arguments with Object[]
if you are using more than two:
LOGGER.info("{}:{}:{}", new Object[] {one, two, three})
You might be using an old version of slf4j.
In previous version you could only log up to 2 parameters in this way, but newer version can take any number of parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With