Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to log to file using SLF4j without line feeds?

Is it possible to log to file using SLF4j without line feeds?

Basically, I have a waitTimer() method that prints a "." once per second and I want all the dots to appear on one line in the log file.

like image 472
djangofan Avatar asked Dec 06 '25 06:12

djangofan


1 Answers

From this, if you have %n in your log4j layout, line separator such as "\n" will be appended at each message automatically. Remove it will make all messages appear in one line. But if you also want to keep other message with line feeds, you'd better define two appender.

like image 192
Jintian DENG Avatar answered Dec 08 '25 02:12

Jintian DENG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!