Saturday, 31 August 2013

NLog adding Header Footer dynamically at run time

NLog adding Header Footer dynamically at run time

I want to add header and footer at run time dynamically. Meaning that
after I added them they will start appearing at my rolling log files.
I managed to add only one line like this.
LayoutWithHeaderAndFooter tt = new LayoutWithHeaderAndFooter();
tt.Header = @"----------------- Logging started on ${longdate}
------------------";
tt.Layout = @"${date:format=HH\:mm\:ss.fff} ${level} ${logger}
${message}";
tt.Footer = @"----------------- Logging finished on ${longdate}
-----------------";
And then I am adding it to my file target fileTarget.Layout = tt;
Any idea how to to it to more than one line with collection of messages or
something similar...

No comments:

Post a Comment