logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Kulkarni" <ashish.kulkarn...@gmail.com>
Subject Logging messages using java 1.5 format string
Date Mon, 04 Aug 2008 19:45:03 GMT
Hi
Is there anyway to format the log messages using java 1.5 format
capabilities
for example i can have a nice formatted out put using
System.out.format("Number of Users on Registry %1$s, is %2$d",
registry.getName(), userSet.size());

Can i do some thing like
logger.debug("Number of Users on Registry %1$s, is %2$d",
registry.getName(), userSet.size());

I would hate to have to do
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb);
formatter.format("Number of Users on Registry %1$s, is %2$d",
registry.getName(), userSet.size());
logger.debug(sb);

to get formatted output,
Any ideas

Ashish

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message