<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">String.replace() ?</div><br class=""><div><blockquote type="cite" class=""><div class="">On 20 Feb 2015, at 00:43, Tadikonda, Santosh <<a href="mailto:Santosh.Tadikonda@neustar.biz" class="">Santosh.Tadikonda@neustar.biz</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.65pt; background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 11.5pt; font-family: Helvetica, sans-serif; color: rgb(34, 34, 34);" class="">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 ?<o:p class=""></o:p></span></p><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.65pt; background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 11.5pt; font-family: Helvetica, sans-serif; color: rgb(34, 34, 34);" class="">Code:<o:p class=""></o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; color: rgb(43, 145, 175); border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">String</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span>str =<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">"george\nmason"</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">logger.info(str);</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(57, 51, 24);" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.65pt; background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 11.5pt; font-family: Helvetica, sans-serif; color: rgb(34, 34, 34);" class="">Logback pattern:<o:p class=""></o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><pattern>[%d{dd MMM yyyy HH:mm:ss,SSS}] [%</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">5p</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">] [%X{sid}] [%-</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">20C</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">{</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">0</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">} %</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">25M</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">]:[%-</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">4L</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">] - %m%n</pattern></span><span style="font-size: 10pt; font-family: Consolas; color: rgb(57, 51, 24);" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.65pt; background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 11.5pt; font-family: Helvetica, sans-serif; color: rgb(34, 34, 34);" class="">Expected:<o:p class=""></o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">[</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">19</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: rgb(43, 145, 175); border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">Feb</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">2015</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">20</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">:</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">19</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">:</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">27</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">] [ INFO] [] [myClass myMethod]:[</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">52</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""> ] - george\nmason</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(57, 51, 24);" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif; line-height: 14.65pt; background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 11.5pt; font-family: Helvetica, sans-serif; color: rgb(34, 34, 34);" class="">Actual Output:<o:p class=""></o:p></span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">[</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">19</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: rgb(43, 145, 175); border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">Feb</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">2015</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">20</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">:</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">19</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">:</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">27</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">] [ INFO] [] [myClass myMethod]:[</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial;" class="">52</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class=""> ] - george<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: rgb(238, 238, 238);" class=""><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0in; background-color: rgb(238, 238, 238);" class="">mason</span><span style="font-size: 10pt; font-family: Consolas; color: rgb(57, 51, 24);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><a href="http://stackoverflow.com/questions/28616286/how-to-prevent-logback-slf4j-from-parsing-a-new-line-character" style="color: purple; text-decoration: underline;" class="">http://stackoverflow.com/questions/28616286/how-to-prevent-logback-slf4j-from-parsing-a-new-line-character</a><o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Appreciate any help.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 9pt; font-family: Arial, sans-serif;" class=""> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">Thanks<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">Santosh</span><o:p class=""></o:p></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Logback-user mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:Logback-user@qos.ch" style="color: purple; text-decoration: underline; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Logback-user@qos.ch</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://mailman.qos.ch/mailman/listinfo/logback-user" style="color: purple; text-decoration: underline; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://mailman.qos.ch/mailman/listinfo/logback-user</a></div></blockquote></div><br class=""></body></html>