Custom Parameter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Custom Parameter


I'm using NLog for the first time and struggling to set it up with an existing project;

I've got it producing simple logs to a text file and over UDP to Sentinel but I can't seam to pass through the custom parameters I've added.


static Logger logger = LogManager.GetLogger("TransactionLogging");  //  code inside class 'TransactionLogging'

private void WriteToLog()
        LogEventInfo newTransactionLog = new LogEventInfo(LogLevel.Info, "", "Transaction Details");

        newTransactionLog.LoggerName = logger.Name;
        newTransactionLog.Properties.Add("SessionId", this.SessionId);
        newTransactionLog.Properties.Add("Request", formattedRequest);
        newTransactionLog.Properties.Add("Response", formattedResponce);


I read another post on here (dated 2006) which looked to be storing custom parameters in a database but the structure of the xml was unsupported in the latest version of NLog and I couldn't get it to work

If someone can point me in the right direction I would be very grateful :)