[logback-user] How to prevent logback/slf4j from parsing a new line character

David Roussel nabble at diroussel.xsmail.com
Fri Feb 20 10:42:42 CET 2015


String.replace() ?

> On 20 Feb 2015, at 00:43, Tadikonda, Santosh <Santosh.Tadikonda at neustar.biz> wrote:
> 
> I'm using logback with SLF4j for logging in my application. I have a string that contains a new line character. It is part of the string value but doesn't signify a new line. When I print the string, logback prints it in a new line. How to prevent this ?
> 
> Code:
> 
> String str = "george\nmason"
> logger.info(str);
> Logback pattern:
> 
> <pattern>[%d{dd MMM yyyy HH:mm:ss,SSS}] [%5p] [%X{sid}] [%-20C{0} %25M]:[%-4L] - %m%n</pattern>
> Expected:
> 
> [19 Feb 2015 20:19:27] [ INFO] [] [myClass myMethod]:[52  ] - george\nmason
> Actual Output:
> 
> [19 Feb 2015 20:19:27] [ INFO] [] [myClass myMethod]:[52  ] - george
> mason
>  
> http://stackoverflow.com/questions/28616286/how-to-prevent-logback-slf4j-from-parsing-a-new-line-character <http://stackoverflow.com/questions/28616286/how-to-prevent-logback-slf4j-from-parsing-a-new-line-character>
>  
> Appreciate any help.
>  
> Thanks
> Santosh
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch <mailto:Logback-user at qos.ch>
> http://mailman.qos.ch/mailman/listinfo/logback-user <http://mailman.qos.ch/mailman/listinfo/logback-user>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150220/f92aff95/attachment-0001.html>


More information about the Logback-user mailing list