Is it possible with NLog to emit a multi-line message such that each line is formatted according to the current layout? E.g.
2015-12-17 11:37:38.0845 | 64 | INFO | -----------------------------------
2015-12-17 11:37:38.0845 | 64 | INFO | Statistics:
2015-12-17 11:37:38.0845 | 64 | INFO | Crawling Requests 46887 /min
2015-12-17 11:37:38.0845 | 64 | INFO | Stored Documents 9910 /min
2015-12-17 11:37:38.0845 | 64 | INFO | -----------------------------------
Alternatively, is it possible with NLog to emit multiple messages as a single, non-interrupted block in a multithreaded environment?
You can do all this from your config.
<variable name="statData" value="${longdate} | 64 | ${level} | "/>
<variable name="line" value="-----------------------------------"/>
<targets>
<target xsi:type="Console"
name="Console"
layout="
${statData}${line}${newline}
${statData}Statistics:${newline}
${statData} Crawling Requests 46887 /min ${newline}
${statData} Stored Documents 9910 /min ${newline}
${statData}${line}${newline}"/>
Wasn't exactly sure what your 64 was or where you were getting your per minute data. Probably a variable or something your inserting.This should also work if you are logging to a file not the console.
As for your second question, if you are wanting a single log message from multiple threads I think you would have to do that on the code side. You would have to collect your threads, get your log data you want and send it 1 time to nLog. I might be misunderstanding though
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With