soure-file and line / Seperate "normal" log and Exception log

1 message Options
Embed this post
Permalink
ToniM

soure-file and line / Seperate "normal" log and Exception log

Reply Threaded More More options
Print post
Permalink
Hello,

i developed NLog today, so i'm not really fit at using it.
I have 2 questions so far (i know, only the 1st is depending to this thread):
- how do i get the file name and the line number of the raised log event into my logfile?
- how can i seperate the layout (in target) coming from a logger.*Exception(...); call or not?


NLog.config - START:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <variable name="logDirectory" value="C:\temp" />
  <variable name="logLayout" value="[${longdate}][${callsite}][${windows-identity:domain=false}][${level}][${message}]'" />

  <targets>
    <target name="file" xsi:type="File"
        layout="${logLayout}"
        fileName="${logDirectory}/logfile.${windows-identity:domain=false}.log"
        archiveFileName="${logDirectory}/logfile.${windows-identity:domain=false}.{##}.log"
        includeSourceInfo="true"
        archiveEvery="None"
        archiveAboveSize="512"
        archiveNumbering="Rolling"
        maxArchiveFiles="5"
        concurrentWrites="true"
        keepFileOpen="false"
        encoding="iso-8859-1" />
    <target name="console" xsi:type="Console"
        layout="${logLayout}"
        includeSourceInfo="true" />
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="console" />
  </rules>

</nlog>
NLog.config - END


So, i hope you can help me.

But although: thanks!


Have a good one,
ToniM