Inserting spaces or characters in log messages

1 message Options
Embed this post
Permalink
willy potts

Inserting spaces or characters in log messages

Reply Threaded More More options
Print post
Permalink
I would like to separate the fields displayed in my log file with a space or possibly some character.  Currently there is no separation between fields, and I can't figure out how to change this.

Here's an example from the log file:

2008-09-01 09:32:28.8750DebugAuthentication.CreateNewSessionClientID=2

Here's my config file:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <targets>
        <!-- Log in a separate thread.
             When the queue overflows, grow the queue. -->
        <target name="file" xsi:type="AsyncWrapper" overflowAction="Grow">
            <target xsi:type="File" filename="${basedir}\Logs\${mdc:clientPrefix}\${shortdate}.log"
                    layout="${longdate}${level}${callsite}${message}"/>
        </target>
    </targets>

    <rules>
        <logger name="*" minLevel="Trace" writeTo="file"/>
    </rules>
</nlog>

I tried just inserting characters in the 'layout' of the target, but it didn't work.

Thanks in advance,

willy potts