# nultiline message log4net pattern

**URL:** <https://forum.log4view.com/t/nultiline-message-log4net-pattern/93>\
**Category:** Log4View Support\
**Created:** [July 25, 2017, 1:14pm UTC](https://forum.log4view.com/t/nultiline-message-log4net-pattern/93 "2017-07-25T13:14:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forum.log4view.com/images/discourse-logo-sketch-small.png) [@system](https://forum.log4view.com/u/system)\
**Post date:** [July 25, 2017, 1:14pm UTC](https://forum.log4view.com/t/nultiline-message-log4net-pattern/93/1 "2017-07-25T13:14:53Z")

</div>

_Guest on Nabble:_ `eli`

I can’t seem to figure out what type of log4net pattern I can give it so that it picks up messages with newline characters. My current pattern is  
%-5level | %date{ABSOLUTE} | %-4thread | %30.30logger | %message%newline  
problem is for messages that contain newlines only the firs line is read (until it hits the first %newline). I’ve tried setting the layout pattern in log4view to exclude the newline  
%-5level | %date{ABSOLUTE} | %-4thread | %30.30logger | %message  
but that doesn’t help. What pattern can I give log4view so that it consumes everything up to the next log entry into the message?  
Ideally I would like a pattern I can give log4view without having to modify the actual log4net output pattern. If that’s not possible, the next best thing would be the least intrusive change to the log4net pattern (double trailing newline wouldn’t work, since for all logs it will skip a line). Thank you.

---

<div class="post-metadata">

**Author:** ![Philipp\_Lauchner](https://forum.log4view.com/user_avatar/forum.log4view.com/philipp_lauchner/32/8_2.png) [@Philipp\_Lauchner](https://forum.log4view.com/u/Philipp_Lauchner)\
**Post date:** [July 28, 2017, 1:20pm UTC](https://forum.log4view.com/t/nultiline-message-log4net-pattern/93/2 "2017-07-28T13:20:22Z")

</div>

Dear eli,

unfortunatelly this is a known problem of pattern based messages. You can find a discussion of that problem in this thread:  
[http://forum.log4view.com/NLog-multiline-Log-Message-tp245.html](http://forum.log4view.com/NLog-multiline-Log-Message-tp245.html)

To sum up, the possible solutions are:

- Use the xml layout (highly recommended by us)

- Use a layout renderer to remove newlines within your message when logging them: [https://github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer](https://github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer)

- Add a specific identifier to the start of your pattern, e.g.: **#MessageStart#** _%-5level | %date{ABSOLUTE} | %-4thread | %30.30logger | %message%newline_

Yours sincerely

Philipp Lauchner  
**PROSA GmbH**   
Development & Support
