Home Help Center

NLog not working correctly

PapayPapay Member Dmitriy EvsyukovOrganization: AigrindProject: Best MMORPG
I created a service and run it under IceBox, use NLog for logging.

When I call the Debug, it does not show.
If I call Console.WriteLine - the messages are seen.
What am I doing wrong?
How to configure logging to be able to use NLog?

NLog.config:
<?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">

  <!-- 
  See http://nlog-project.org/wiki/Configuration_file 
  for information on customizing logging rules and outputs.
   -->
  <targets>
    <!-- add your targets here -->
    <target xsi:type="Console" name="c" layout="${longdate} ${uppercase:${level}} ${callsite:className=true:includeSourcePath=false:methodName=true}:: ${message}"/>

    <!--
    <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" />
    -->

  </targets>

  <rules>
    <!-- add your logging rules here -->
    <logger name="*" minlevel="Debug" writeTo="c" />

    <!--
    <logger name="*" minlevel="Trace" writeTo="f" />
    -->
  </rules>
</nlog>

Comments

  • PapayPapay Member Dmitriy EvsyukovOrganization: AigrindProject: Best MMORPG
    NLog.config not found

    I'm resolved this problem.
    By default, NLog looks for a config file near executing file and not found it because executing file is iceboxnet.exe, but my assembly in another path.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Dmitriy,

    I am glad you were able to figure this out, and thank you for posting the answer.

    Best regards,
    Bernard
Sign In or Register to comment.