<PackageReference Include="NLog" Version="6.1.3" />

NLog.LayoutRenderers.Wrappers.XmlEncodeLayoutRendererWrapper

Converts the result of another layout output to be XML-compliant.
public bool CDataEncode { get; set; }

Gets or sets whether output should be wrapped using CDATA section instead of XML-string escaping

public bool XmlEncode { get; set; }

Gets or sets whether output should be encoded with XML-string escaping.

public bool XmlEncodeNewlines { get; set; }

Gets or sets a value indicating whether to transform newlines (\r\n) into ( )