[logback-user] Logback pattern to truncate a message from end after 500 characters and append a characters only on truncation

Sagar Shah Sagar.Shah at medhost.com
Thu May 4 19:01:05 CEST 2017


Hello everyone,
I found out a way to truncate a message in logback after 500 characters using encoding patterns like shown below.
<encoder>
    <pattern>%d [%thread] %-5p %logger{56}:%line - %.-500m%n</pattern>
</encoder>

But I would also want to append some extra characters at the end, say '...', if the message was truncated. Is that possible in logback? 3 dots don't need to be added in every log message, but only in the truncated messages.

Please advise.

Regards,
Sagar Shah

Sagar Shah
Sr. Software Engineer

[MEDHOST logo]
6550 Carothers Parkway Suite 160 Franklin, TN 37067
p. c. f.
Sagar.Shah at medhost.com<mailto:Sagar.Shah at medhost.com>


MEDHOST welcomes your feedback on our service. If there are any areas we can improve, please email our Quality Service Department at medhostquality at medhost.com<mailto:medhostquality at medhost.com>. If you receive STAR service, please email medhoststar at medhost.com<mailto:medhoststar at medhost.com> and tell us about your experience. We appreciate your business.


CONFIDENTIALITY STATEMENT: The documents accompanying this transmission may contain confidential and/or legally privileged health or other information. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party unless required to do so by law or regulation and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or action taken in reliance on the contents of these documents is strictly prohibited. If you have received this information in error, please notify the sender immediately and arrange for the return or destruction of these documents.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20170504/9baed26a/attachment.html>


More information about the logback-user mailing list