Hello Geoffrey,

Geoffrey De Smet wrote:
Hi,

Is it possible to do something like this?

int timeTakenInMilliseconds) = 3662000;
logger.info("It took {hh:mm:ss} seconds", timeTakenInMilliseconds);

which prints this to the log:

"It took 1 hours 1 minutes 2 seconds."

The idea is that the timeTakeInMilliseconds is only parsed if info logging is on.

Is String.printf syntax allowed in the format of logger.info(format, args)?

No. SLF4J message formatter only perform simple toString conversion on objects. It does not support printf syntax.


--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
_______________________________________________
user mailing list
user@slf4j.org
http://www.slf4j.org/mailman/listinfo/user

Reply via email to