<?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"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
      autoReload="true"
      throwExceptions="false"
      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">

  <!-- optional, add some variables
  https://github.com/nlog/NLog/wiki/Configuration-file#variables
  -->
  <variable name="myvar" value="myvalue"/>

  <targets>

    <variable name="SPID" value="" size="50" />
    <variable name="KomunikatTyp" size="50" value="" />
    <variable name="KomunikatSzczegoly" value="" />
    <variable name="KomunikatNumer" value="" size="50" />
	<variable name ="Instancja" value="" size="50" />


    <target name="Loggs" xsi:type="File" fileName="${basedir}/logs/${shortdate}.log"
            layout="${longdate} |
 ${processname} |
 ${var:SPID} |
 ${var:KomunikatTyp} |
 ${message} |
 ${var:KomunikatSzczegoly} |
 ${var:Instancja} |
 ${var:KomunikatNumer} |"/>

    <target name="Data" xsi:type="Database" connectionStringName="NLog" commandText="exec AO.LTN @date, @name, @SPID, @kom, @tresc, @szcz,@instancja, @nr, @ver" >
      <parameter name="@date" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff}"/>
      <parameter name="@name" layout="${processname} " />
      <parameter name="@SPID" layout="${var: SPID} " />
      <parameter name="@kom" layout="${var: KomunikatTyp} " />
      <parameter name="@tresc" layout="${message} " />
      <parameter name="@szcz" layout="${var: KomunikatSzczegoly} " />
	  <parameter name="@instancja" layout="${var:Instancja} " />
      <parameter name="@nr" layout="${var: KomunikatNumer} " />
      <parameter name="@ver" layout="1.2.1" />
    </target>


  </targets>

  <rules>
    <logger name ="*" minlevel="Debug" writeTo="Loggs" />
    <logger name ="*" minlevel="Debug" writeTo="Data" />
  </rules>
</nlog>
