Vincent Massol wrote:
On Nov 21, 2008, at 2:51 AM, Sergiu Dumitriu wrote:
vmassol (SVN) wrote:
+ getLogger().debug("The
[" +
macroHolder.macroBlock.getName() + "] macro doesn't support inline
mode.");
+ getLogger().debug("Failed to execute macro [" +
macroHolder.macroBlock.getName() + "]. Internal error ["
+ + e.getMessage() + "]");
getLogger().debug("Failed to locate macro [" +
macroBlock.getName() + "]. Ignoring it.");
You should use the new
formatting logger methods, like:
getLogger().debug("Failed to locate macro [{0}]. Ignoring it.",
macroBlock.getName());
Can you remind me what are the advantages since I see 2 drawbacks:
* the log message becomes harder to write and read since you need to
mentally map the numbers with the parameters
Heh, I thought the opposite, that having to walk past parameters to
reconstruct the message is harder. I guess that for fewer parameter and
smaller parameter retrieval code it is better like this, but I really
get confused when I have to read long log messages.
* If you have single quote in debug messages it'll
fail (in message
formats you must always use '' (two single quotes) to display a single
single quote. I've been bitten by this in the past.
Yes, but generally we don't use quotes in message formats.
Note that performance don't matter at all for
logging errors.
One advantage I'd see is to for i18n, However I don't think we want to
internationalize error messages.
Agreed, we already decided not to translate errors.
I'm not against using this. I just want to be sure
we have a good
rationale before we start converting systematically all our logs to it.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/