Using parameterized messages while logging


(Svitlana Honcharuk) #1

Hi everyone,

I’m working on TRUNK-5437 which is created to update some old classes to use parameterized logging.

On OpenMRS Wiki there is an example of how to log and how to not. The thing which confuses me is that in ‘good’ case there is no if statement:

log.debug(The entry is {}., entry);

So the question is, do we still need an if statement when we use parameterized logging? Or does parameterizing automatically mean that debugger is enabled?


(Suthagar Kailayapathy) #2

Hi @lana

Actually we are following to use the parameterized logging by the conventions. So you need to change that log line according to parameterized logging syntax.

Next, we don’t want that IF statement also, since if the debug is enabled only we can get the debug logs. So no need to recheck that using a IF statement.