Description
Try to assign UUID into the StructuredDataMessage, but failed with :
Exception in thread "main" java.lang.IllegalArgumentException: Length of id dd570301-85b6-11e9-a708-983b8f59247d exceeds maximum of 37 characters
at org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:103)
Found the bug in the code
https://github.com/apache/logging-log4j2/blob/master/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
public StructuredDataId(final String name, final String[] required, final String[] optional, final int maxLength) { int index = -1; if (name != null) { if (maxLength > 0 && name.length() > MAX_LENGTH) { throw new IllegalArgumentException(String.format("Length of id %s exceeds maximum of %d characters", name, maxLength)); } index = name.indexOf(AT_SIGN); }
at line 102 , should be
name.length() > maxLength that bring in but the the MAX_LENGTH