Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiline exception to single line using java code

The logs for my Spring Boot Java application are stored in CloudWatch. The problem is when exception occur the stacktrace is not properly coming, since it gets scattered across the CloudWatch. I tried all the logback.xml configs, but it is not working.

Is there any custom encoder java class to append all the stack trace of an exception into a single line so that it will be easy to track back

like image 334
Sathiya prakash Avatar asked Nov 17 '25 13:11

Sathiya prakash


1 Answers

When there is an exception use throwable to wrap in single line with a seperator

<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L %m %throwable{separator(|)} %n"/>
like image 154
karthikmunna Avatar answered Nov 20 '25 04:11

karthikmunna



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!