Skip to content

Commit

Permalink
Log missing environment variables warning to TaskListener instead of …
Browse files Browse the repository at this point in the history
…system log
  • Loading branch information
rgroothuijsen committed Jan 31, 2021
1 parent 25669f1 commit 1bd3095
Showing 1 changed file with 1 addition and 4 deletions.
Expand Up @@ -6,16 +6,13 @@

import java.io.IOException;
import java.util.Map;
import java.util.logging.Logger;

/**
* @since 1.92
*/
@Extension
public class EnvInjectEnvVarsContributor extends EnvironmentContributor {

private final static Logger LOGGER = Logger.getLogger(EnvInjectEnvVarsContributor.class.getName());

@Override
@SuppressWarnings("rawtypes")
public void buildEnvironmentFor(Job job, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
Expand All @@ -30,7 +27,7 @@ public void buildEnvironmentFor(Job job, EnvVars env, TaskListener listener) thr
int expectedEnvSize = env.size() + result.size();
env.putAll(result);
if (env.size() != expectedEnvSize) {
LOGGER.warning("Not all environment variables could be successfully injected. " +
listener.error("Not all environment variables could be successfully injected. " +
"Check for similarly-named environment variables.");
}
}
Expand Down

0 comments on commit 1bd3095

Please sign in to comment.