I would like to extend my log file with static information, like what OS my software is running.
Is there a way to inject this information only once per file that was created and not for every log entry?
This is how I am doing it currently (but this results in outputting the information over and over again - which isnt necessary since it static information)
GlobalContext.Properties["**evInfoOsPlatform**"] = string.Format("OS Platform: {0}", Environment.OSVersion.Platform);
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ABSOLUTE} [%thread] %level
%logger - %message%newlineOperating System Version: %property{
**evInfoOsPlatform**}%newline%exception"/>
</layout>
My desired effect would be a logfile looking like this:
Static information:
OS Version: Windows 8.1.0101934 32-bit
Culture Info: en-US
Domainname: RandomDomain
Username: Emil
Userrights: Admin
Messages:
//now all the messages should be printed...
This code is used in a C# .Net 4.5 WPF environment.
Hope you can help.