Substitute variables in files is ignoring environment in scope

I have a log4net config with email appender configured. I’m using OctopusDeploy to set email appender’s threshold to either “OFF” or “ERROR” depending on which environment i’m deploying to. The variable in Octopus looks like this:

env.log4net.errorsEmailAppenderThreshold = “ERROR” (no scopes)
env.log4net.errorsEmailAppenderThreshold = “OFF” (Dev1)

So basically, “OFF” threshold will be set on any dev environment (ie Dev1) otherwise it’ll be set to ERROR.

My log4net.config contains the following line referencing the variable:

<threshold value="#{env.log4net.errorsEmailAppenderThreshold}"/>

What i’m seeing is really trippy. I tried deploying to Dev1 and saw that Octopus was setting threshold to “ERROR”! I triple checked everything and it just didn’t make sense. So I renamed the variable from “ERROR” to “ERROR!!”, deployed again and saw “ERROR” in the threshold value again! This started to look crazy so I deleted the variables in OctopusDeploy and recreated them and only then it started setting threshold to “OFF” as expected.

Now i changed the deployment process to deploy yet another service via deploy package step with its own log4net config. Both services are deployed within the same project in Octopus so same sets of variables are applied. And low and behold the problem has come back. I am now seeing “ERROR” in Dev1 for this new project and “OFF” in the first project. This makes absolutely no sense. It’s applying correctly in one deployment but not the other. I tried recreating variables again, but this doesn’t seem to change anything.

I’m using Octopus 3.2.22. Does anybody have suggestions?


So I renamed the variable from “ERROR” to “ERROR!!”, deployed again and saw “ERROR” in the threshold value again!

I meant i changed variable value from “ERROR” to “ERROR!!” and still saw that Octopus was applying “ERROR” instead of “ERROR!!”.

Found the culprit. Looks like I had an old release transform that I blew away locally but somehow didn’t commit to git. It was getting applied on every build. Sorry for the confusion. I’ll close this.

Hi Sergey,

Glad you got it sorted :slight_smile: