Reputation: 841
It is possible to pass the system/environment information to the log4net log in my C# WinForms application?
It would be good to have details like what Windows version they are using, if any Service Packs are installed, what .Net they have installed etc.
Upvotes: 1
Views: 155
Reputation: 13854
I haven't used Log4Net for a long time, but can't you set this information to the global or thread context?
log4net.GlobalContext.Properties["WindowsVersion"] = windowsVersion;
Then you can output this information in your log file with the following pattern:
%property{WindowsVersion}
See http://logging.apache.org/log4net/release/manual/contexts.html for more information.
Upvotes: 1