diff --git a/logstash-core/src/main/java/org/logstash/log/LogstashMessageFactory.java b/logstash-core/src/main/java/org/logstash/log/LogstashMessageFactory.java index cca2f141831..28cf11fd9e9 100644 --- a/logstash-core/src/main/java/org/logstash/log/LogstashMessageFactory.java +++ b/logstash-core/src/main/java/org/logstash/log/LogstashMessageFactory.java @@ -21,7 +21,7 @@ package org.logstash.log; import org.apache.logging.log4j.message.Message; -import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.message.MessageFactory2; import org.apache.logging.log4j.message.ObjectMessage; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.message.SimpleMessage; @@ -30,8 +30,10 @@ /** * Used in Log4j configuration. + * + * Requires Log4j 2.6 and above. * */ -public final class LogstashMessageFactory implements MessageFactory { +public final class LogstashMessageFactory implements MessageFactory2 { public static final LogstashMessageFactory INSTANCE = new LogstashMessageFactory(); @@ -53,4 +55,59 @@ public Message newMessage(String message, Object... params) { return new ParameterizedMessage(message, params); } } + + @Override + public Message newMessage(CharSequence charSequence) { + return new SimpleMessage(charSequence); + } + + @Override + public Message newMessage(String message, Object p0) { + return newMessage(message, new Object[]{p0}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1) { + return newMessage(message, new Object[]{p0, p1}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2) { + return newMessage(message, new Object[]{p0, p1, p2}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3) { + return newMessage(message, new Object[]{p0, p1, p2, p3}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4, p5}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4, p5, p6}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4, p5, p6, p7}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4, p5, p6, p7, p8}); + } + + @Override + public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + return newMessage(message, new Object[]{p0, p1, p2, p3, p4, p5, p6, p7, p8, p9}); + } }