These fields are populated from environment variables using VcapEnvReader except for CORRELATION_ID, TENANT_ID and TENANT_SUBDOMAIN. If variables are unknown, cf-java-logging-support will still add the fields to the generated log message with a value of "-". This behaviour enlarges the log messages without giving any benefit.
Compare the following test messages, the first containing the default values, the second with the respective fields removed:
Their sizes are 465 vs 268 characters. In the example 200 bytes of unnecessary log volume was created. There should be an option to suppress the generation of context fields with default values. So that instead of the first message of the example the library would generate the second message of the example.
cf-java-logging-support attaches a default set of fields to every log messages defined as
CTX_FIELDS
in LogContext:These fields are populated from environment variables using VcapEnvReader except for
CORRELATION_ID
,TENANT_ID
andTENANT_SUBDOMAIN
. If variables are unknown, cf-java-logging-support will still add the fields to the generated log message with a value of "-". This behaviour enlarges the log messages without giving any benefit.Compare the following test messages, the first containing the default values, the second with the respective fields removed:
Their sizes are 465 vs 268 characters. In the example 200 bytes of unnecessary log volume was created. There should be an option to suppress the generation of context fields with default values. So that instead of the first message of the example the library would generate the second message of the example.