This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Within the context of logging performance and efficiency, an advantage of the MessageFormat example over the String.format is that if logger.isLoggable(Level.FINER) is false, the MessageFormat example may do less work. It will create a new Object array with the values of transactionId and will call getName like the String.format example, but it may skip the string formatting.
MessageFormatmay be a little heavier than String.format so your performance may be better if you used String.format, StringBuilder or String concatenation (+) in a loggable test if you're not logging FINER all the time. Especially if you have no localization needs in logging. Eg:
The SLF4J library encourages the parameterized logging and has a built-in formatter that is lighter than MessageFormat. They address performance for the not-logging case in their FAQ entry titled "What is the fastest way of (not) logging?". There are some long drawn-out discussions in the Hadoop project about testing if a logging level is enabled or not, like HADOOP-6884, that shed some more insights on this subject.