Does anyone know how to dump environment name in log4net?
e.g.
<conversionPattern value="%date{ISO8601} Server:%property{log4net:HostName} [%-5level] %m" />
This will give computer name.
Does anyone know how to dump environment name in log4net?
e.g.
<conversionPattern value="%date{ISO8601} Server:%property{log4net:HostName} [%-5level] %m" />
This will give computer name.
Not sure what do you mean by "environment name", but with log4net contexts you can log anything: logged on user, ip address if dynamic etc.
Not sure how to add it to the e-mail subject, but in the body pattern would be:
<conversionPattern value="%date{ISO8601} Server:%property{environment} [%-5level] %m" />
after you init log4net, call this:
log4net.GlobalContext.Properties["environment"] =
Environment.GetEnvironmentVariables("EnvironmentName")+"AppName";
Whenever we send any error email, in our subject we put (computer name + application name) e.g. (Computer21TwitterApplicaiton)
In the computer, i have set environment variable i.e Development. So now i want to have subject value as (Environment Name + applicaiton Name) e.g (DevelopmentTwitterApplication)