@Plugin(name = "WDD3DLayout",
category = Node.CATEGORY,
elementType = Layout.ELEMENT_TYPE,
printObject = true)
public class GlobalLogLayout extends AbstractStringLayout {
protected GlobalLogLayout(Charset charSet) {
super(charSet);
}
@PluginFactory
public static GlobalLogLayout createLayout(@PluginAttribute(value = "charset", defaultString = "UTF-8") Charset charset) {
return new GlobalLogLayout(charset);
}
@Override
public String toSerializable(LogEvent logEvent) {
try {
return new ObjectMapper().writeValueAsString(SerializableLogEvent.from(logEvent));
} catch (JsonProcessingException e) {
throw new WddException("It was not possible to serialize logEvent object.", e);
}
}
private static class SerializableLogEvent {
private String message;
private String level;
private String server;
private String uuid;
private String application;
private String timestamp;
private String user;
public static SerializableLogEvent from(LogEvent logEvent){
SerializableLogEvent serializableLogEvent = new SerializableLogEvent();
serializableLogEvent.setMessage(logEvent.getMessage().getFormattedMessage());
serializableLogEvent.setLevel(logEvent.getLevel().name());
try {
serializableLogEvent.setServer(InetAddress.getLocalHost().toString());
} catch (UnknownHostException ignore) {
serializableLogEvent.setServer("");
}
serializableLogEvent.setUuid((String) logEvent.getMessage().getParameters()[0]);
serializableLogEvent.setApplication(logEvent.getMessage().getParameters()[1].toString());
serializableLogEvent.setTimestamp(logEvent.getMessage().getParameters()[2].toString());
serializableLogEvent.setUser(logEvent.getMessage().getParameters()[3].toString());
return serializableLogEvent;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getServer() {
return server;
}
public void setServer(String server) {
this.server = server;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
}
}
When, i start the aplication, the below problem ocorr: "ERROR Kafka contains an invalid element or attribute "WDD3DLayout""
I don't found the error... can you help? is it one Bug?
Hi, i have one problema in my application and i need to check...
1 - i use the springboot in this version:
and, this dependency for log4j and kafka
I use the log4j2.xml in the atachment...
In the springBoot application, i have this plugin configutated:
When, i start the aplication, the below problem ocorr: "ERROR Kafka contains an invalid element or attribute "WDD3DLayout"" I don't found the error... can you help? is it one Bug?