dynamic log4net appender name?
Posted
by sanjeev40084
on Stack Overflow
See other posts from Stack Overflow
or by sanjeev40084
Published on 2010-04-13T18:19:08Z
Indexed on
2010/04/13
18:23 UTC
Read the original article
Hit count: 458
Let's say i have 3 smtp appenders in same log4net file whose names are:
<appender name = "emailDevelopment".. />
<appender name = "emailBeta".. />
<appender name = "emailProduction".. />
Let's say i have 3 different servers(Dev, Beta, Production). Depending upon the server, i want to fire the log. In case of Development server, it would fire log from "emailDevelopment". I have a system variable in each server named "ApplicationEnvironment" whose value is Development, Beta, Production based on the server names. Now is there anyway i can setup root in log4net so that it fires email depending upon the server name.
<root>
<priority value="ALL" />
<appender-ref ref="email<environment name from whose appender should be used>" />
</root>
© Stack Overflow or respective owner