NLog change eventlog target to something else than Application RRS feed

  • Question

  •  Changed the target log from Application to "xxxx". I removed the Source using powersheel and the created it under "xxxx". when i write event's it doesn't appear anywhere

    target = LogManager.Configuration.FindTargetByName("eventlog");
    mode = config.RUN_MODE;
    ((NLog.Targets.EventLogTarget)target).Log = "xxxx";
    LoggingConfiguration loggingConfiguration = new LoggingConfiguration();
    var asyncFileTarget = new AsyncTargetWrapper(target);
    loggingConfiguration.AddTarget("eventlog", asyncFileTarget);
    LogManager.Configuration.AddRule(LogLevel.Info, LogLevel.Fatal, target, mode, true);
    LogManager.Configuration = loggingConfiguration;

    I removed and added using powershell the new log and source (the "xxxx" log was created):

    Remove-EventLog -Source "mySource" 
    New-EventLog -LogName xxxx -Source "mySource code here

    i tried all, i even change the log="xxxx" in the app.config but it still doesn't write to the new event log

    any idea?

    • Edited by want 2 Learn Thursday, May 23, 2019 7:42 PM source code
    • Moved by CoolDadTx Tuesday, May 28, 2019 1:57 PM Third party product
    Thursday, May 23, 2019 7:41 PM

All replies