Add ZeroWidthChar in Quarkus logs

Viewed 42

I want to configure a multi-line processor using PLG stack (Promtail, Loki & Grafana) with Quarkus services. I am following this link to do so, but I am unable to inject the zero-width-character in my quarkus-app/application.properties file: it either print it as is or replace it with a ?. Here is what I tried so far :

quarkus.log.console.format=U+200B%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

quarkus.log.console.format=​%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

Any ideas ?

1 Answers

I am not sure why that isn't working for you - you could try the alternate representations such as ​ or ​ or perhaps the java Unicode \u200B e.g.

quarkus.log.console.format=\u200B%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

If none of those work and you can't get any Zero-width space to render as you like then as the document says...

"Any special character that is unlikely to be part of your regular logs should do just fine"

So perhaps you could just tilde ~, or asterisk *, or some other non alpha-numeric symbol?

e.g.

tilde

quarkus.log.console.format=~{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n
Related