end prefix with a space
See original GitHub issueHey guys,
whenever I add a space at the end of my pattern it’s not respected. I tried to use xml:space="preserve"
but it doesn’t work.
I’d like to get something like
<14> 2016-10-07T21:10:42.458Z log.json {"@timestamp":"2016-10-07T23:10:42.458+02:00"...
but I get
<14> 2016-10-07T21:10:42.458Z log.json{"@timestamp":"2016-10-07T23:10:42.458+02:00"...
^
Here is the configuration I use :
<appender name="loghost" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<remoteHost>localhost</remoteHost>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<prefix class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern xml:space="preserve"><14> %date{"yyyy-MM-dd'T'HH:mm:ss.SSS", UTC}Z log.json </pattern>
</layout>
</prefix>
</encoder>
</appender>
Any idea how to fix it ?
Thank you
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
logfellow/logstash-logback-encoder - end prefix with a space
Hey guys, whenever I add a space at the end of my pattern it's not respected. I tried to use xml:space="preserve" but it...
Read more >PREFIX WITH "SPACE" crossword clue
All solutions for "Prefix with "space"" 17 letters crossword clue - We ... 'PREFIX WITH "SPACE"' is a 17 letter Phrase starting with...
Read more >How to Prefix Substrings in a Space-Delimited String in Shell ...
So we're all on the same page, by "portable" I mean "portable across different linux shells (sh, bash, ksh, zsh, tsh, csh, etc.)"...
Read more >bot's prefix with space on end - Forums - Discord Bot Maker
I dont think you can have a space in the prefix or the command. You can specify seperate parameters after that but the...
Read more >Prefix For 'Space' - Crossword Clue Answers
93%, HYPER, Prefix for 'space' ; 3%, NEO, Prefix for 'pronoun' ; 3%, VACUUM, Empty space ; 3%, SLOT, Schedule space.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah hah! I just found another hack/workaround that doesn’t require any code.
Try this:
This tells logback to output the MDC value with the key named
keyThatWillNeverExist
(which obviously doesn’t exist), and pad the value by 1. This will always output one space.Thank you so much @philsttr. It works exactly like I wanted. I was going to use your first method when I saw it but not having to compile anything is far better. I agree that we should have a way to add a space without using such hacky ways … FYI, I’ve also removed
xml:space="preserve"
which doesn’t seem necessary