Question settings NLog ( logger for .Net )?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
10 views
There is a service with a reference library No. 1,

Service calls 2 methods from the library №1.


Library # 1 contains a reference to the library No. 2.

Library no 1 pulls the methods from the library No. 2.


( Tools -> library 1 -> library No. 2 )


Nlog.config made for the library No. 1, surrounded by the calls of her methods library №2 of the logger.


— Configuration log for the library No. 1:

<?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>
   <target xsi:type="File"
       name="logfile"
       fileName="${basedir}/log_worker.txt"
       layout="${longdate}:${message} ${exception:format=message,stacktrace:separator=*}" />
   
   <target xsi:type="EventLog"
     name="eventlog"
     layout="${longdate}:${message} ${exception:format=message,stacktrace:separator=*}"
     machineName="zabr-PC"
     source="ADReplicator Service Job"
     category="ADReplicator"
     log="Application" />

   <target xsi:type="Console" name="console" />
  </targets>

  <rules>
   <logger name="*" minlevel="Error" writeTo="eventlog" />
   <logger name="*" minlevel="Trace" writeTo="logfile" />
   <logger name="*" minlevel="Info" writeTo="console" />
  </rules>
</nlog>


* This source code was highlighted with Source Code Highlighter.



Question:


What to do to round logs library No. 2? (Or all the same point?)
by | 10 views

2 Answers

0 like 0 dislike
or no need to create a log (because I want to use the same configuration), and just
in the class make a Declaration in the Library № 2
( private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); )
\r
well use it...
\r
Logger.Trace("... ");
by
0 like 0 dislike
all the question is solved, my assumption was correct, charming )
by

Related questions

0 like 0 dislike
1 answer
asked Mar 27, 2019 by Nigrimmist
0 like 0 dislike
2 answers
asked Mar 22, 2019 by Bartez
0 like 0 dislike
7 answers
asked Mar 21, 2019 by taviscaron
0 like 0 dislike
7 answers
asked Mar 23, 2019 by Agent_Smith
0 like 0 dislike
4 answers
110,608 questions
257,186 answers
0 comments
25,726 users