* @param logger The logger to check
* @param messageFactory The message factory to check.
*/
public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
final String name = logger.getName();
final MessageFactory loggerMessageFactory = logger.getMessageFactory();
if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) {
StatusLogger.getLogger().warn(
"The Logger {} was created with the message factory {} and is now requested with the "
+ "message factory {}, which may create log events with unexpected formatting.", name,
loggerMessageFactory, messageFactory);
} else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) {
StatusLogger
.getLogger()
.warn("The Logger {} was created with the message factory {} and is now requested with a null "
+ "message factory (defaults to {}), which may create log events with unexpected formatting.",
name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());