NLog funktioniert nicht so ganz

  • Allgemein

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von dotdev.

    NLog funktioniert nicht so ganz

    Hallo,


    ich habe mir über NuGet NLog installiert.
    Habe das wie folgt eingerichtet:


    1. Eine NLog.config mit folgenden Inhalt erstellt

    XML-Quellcode

    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">
    2. <targets> <target name="logfile" xsi:type="File" fileName="C:\file.txt" /> </targets>
    3. <rules> <logger name="*" minlevel="Info" writeTo="logfile" /> </rules></nlog>




    2. In der app.config habe ich folgendes hinzugefügt

    XML-Quellcode

    1. <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/></configSections>




    3. Jetzt wollte ich es testen, und es passiert nichts :/

    VB.NET-Quellcode

    1. Public Sub Testen() Logger.Trace("Sample trace message") Logger.Debug("Sample debug message") Logger.Info("Sample informational message")Logger.Warn("Sample warning message")Logger.Error("Sample error message")Logger.Fatal("Sample fatal error message")
    2. Logger.Log(LogLevel.Info, "Sample fatal error message") End Sub



    Leider funktioniert es nicht :/.

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „dotdev“ ()