The Builder for LogValueMapFactory should return an unmodifiable map. However, the type of map returned is used to trigger custom serialization of log value maps. In particular, it is used to inject bean identifier attributes (e.g. "_id" and "_class") when the encoder is configured with "injectBeanIdentifier".
So simply wrapping the LogValueMap in a Collections.unmodifiableMap will break type-based serializer selection. Either we need to overload the serializer for Java's unmodifiable map and in the new custom serializer examine the underlying map reflectively and then decide how to serialize. Alternatively, we need to write a custom unmodifiable map delegate class as the UnmodifiableMap class is private in Java's Collections.
The Builder for LogValueMapFactory should return an unmodifiable map. However, the type of map returned is used to trigger custom serialization of log value maps. In particular, it is used to inject bean identifier attributes (e.g. "_id" and "_class") when the encoder is configured with "injectBeanIdentifier".
So simply wrapping the LogValueMap in a Collections.unmodifiableMap will break type-based serializer selection. Either we need to overload the serializer for Java's unmodifiable map and in the new custom serializer examine the underlying map reflectively and then decide how to serialize. Alternatively, we need to write a custom unmodifiable map delegate class as the UnmodifiableMap class is private in Java's Collections.