[
https://issues.apache.org/jira/browse/SOLR-14699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552433#comment-17552433
]
David Smiley commented on SOLR-14699:
-------------------------------------
If not JSON then something non-standard... which is... non-standard ;-). I
recognize JSON embedded in JSON is hideous; we should avoid that.
RE MDC; this is partly a principle of mine because it's a hack that isn't the
intent behind MDC; MDC isn't for structured logging; it's for context (3rd
letter) for things common to many log lines; not for specific log lines. That
said, I acknowledge there are articles "abusing" (IMO) MDC for structure
because it's kind of a least-common-denominator approach to structured logging.
I spent some time pondering this a bit more and I see Log4j2 ObjectMessage
provides a way for us to get structured logging in a way that the appender (and
JsonLayoutTemplate in particular) can recognize and expose as sub-JSON. [This
article|https://medium.com/@zachcorbettmcelrath/structured-logging-in-spring-boot-with-log4j2-part-2-logging-objects-7fa77f8a8c8c]
(and I've seen others) explains. The problem is that we don't want a hard
runtime dependency on Log4j2. I suppose we could have a fallback approach,
detecting ClassNotFound, and then just emitting JSON if not?
> Solr request logs should escape names, values
> (SolrQueryResponse.getToLogAsString)
> ----------------------------------------------------------------------------------
>
> Key: SOLR-14699
> URL: https://issues.apache.org/jira/browse/SOLR-14699
> Project: Solr
> Issue Type: Improvement
> Components: logging
> Reporter: David Smiley
> Priority: Minor
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> {{SolrQueryResponse.getToLogAsString}} encodes the NamedList into a String
> with simple space-separated pairs with name=value. However, it does no
> escaping/encoding, and as-such a value might itself contain spaces and
> equals. This is a problem if these logs are being parsed, and we'd like to
> ensure we do so correctly. Note that SolrLogPostTool (aka "postlogs") parses
> these logs.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]