Skip to content

Null Properties Omitting Value Tag #287

Open
@southernprogrammer

Description

@southernprogrammer

Consider the XML at the bottom of this ticket.

Notice that the following tags do not have a "value" property.

<log4j:data name="ContentType"/>
<log4j:data name="ContentLength"/>

The log viewer that I use is OtrosLogViewer and it cannot parse this data. In fact, it causes no logs to be seen at all because of the parsing error. Currently I'm filtering all null properties with the formatter option UsePropertyFilter to keep this issue from occurring.

I'm okay with this being something that I override with configuration, as not all parsers might not have this issue.

Maybe something like configureOptions.SetNullPropertyValue(NullPropertyValue.NULL) and have the NullPropertyValue enum have the following options: NULL, EMPTY, OMIT. We could also allow for any string to be used.

I will note that < and > must be replaced with &lt; and &gt; in the value

<log4j:event logger="Microsoft.AspNetCore.Hosting.Diagnostics" timestamp="1745594909923" level="INFO" thread="9">
	<log4j:properties>
		<log4j:data name="Protocol" value="HTTP/1.1"/>
		<log4j:data name="Method" value="OPTIONS"/>
		<log4j:data name="ContentType"/>
		<log4j:data name="ContentLength"/>
		<log4j:data name="Scheme" value="https"/>
		<log4j:data name="Host" value="testdev.3-gis.com"/>
		<log4j:data name="PathBase" value="/3GISISP/API"/>
		<log4j:data name="Path" value="/Authenticate"/>
		<log4j:data name="QueryString" value=""/>
		<log4j:data name="EventId.Id" value="1"/>
		<log4j:data name="SpanId" value="c098ff8ab33d0cce"/>
		<log4j:data name="TraceId" value="218c5892763aa30255de1a6fcd356041"/>
		<log4j:data name="ParentId" value="0000000000000000"/>
		<log4j:data name="RequestId" value="40001124-0001-f900-b63f-84710c7967bb"/>
		<log4j:data name="RequestPath" value="/3GISISP/API/Authenticate"/>
		<log4j:data name="log4japp" value="ISPServer.dll(15800)"/>
		<log4j:data name="log4jmachinename" value="TESTDEV"/>
	</log4j:properties>
	<log4j:message>Request starting HTTP/1.1 OPTIONS https://testdev.3-gis.com/3GISISP/API/Authenticate - null null</log4j:message>
</log4j:event>

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions