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
* 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.
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.
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.
Thanks
-Vincent
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs