<xs:simpleType name="levelOrSubstitution">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="TRACE" />
<xs:enumeration value="DEBUG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="WARN" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".+" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
As suggested by @krallus in apache/logging-log4j2#1441 (comment) we can use unions of types to allow any string in attributes and still benefit from IDE suggestions.
For example: