Skip to content

Commit 1009f95

Browse files
Reduce logging level for JCasC YAML loading messages (#975)
* Reduce logging level for JCasC YAML loading messages * Change logging levels in tests
1 parent b279603 commit 1009f95

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

integrations/src/test/java/io/jenkins/plugins/casc/MailExtTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class MailExtTest {
2929

3030
@Rule
3131
public RuleChain chain= RuleChain
32-
.outerRule(logging.record(Logger.getLogger(Attribute.class.getName()), Level.INFO).capture(2048))
32+
.outerRule(logging.record(Logger.getLogger(Attribute.class.getName()), Level.FINER).capture(2048))
3333
.around(j);
3434

3535
private static final String SMTP_PASSWORD = "myPassword";

plugin/src/main/java/io/jenkins/plugins/casc/Attribute.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ public boolean isSecret(@CheckForNull Owner target) {
204204
}
205205

206206
public void setValue(Owner target, Type value) throws Exception {
207-
LOGGER.info("Setting " + target + '.' + name + " = " + (isSecret(target) ? "****" : value));
207+
LOGGER.log(Level.FINE, "Setting {0}. {1} = {2}",
208+
new Object[] {target, name, (isSecret(target) ? "****" : value)});
208209
setter.setValue(target, value);
209210
}
210211

plugin/src/main/java/io/jenkins/plugins/casc/impl/configurators/DataBoundConfigurator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ private T tryConstructor(Constructor<T> constructor, Mapping config, Configurati
121121
clazz.getPackage().isAnnotationPresent(ParametersAreNonnullByDefault.class))) {
122122

123123
if (Set.class.isAssignableFrom(t)) {
124-
LOGGER.log(Level.INFO, "The parameter to be set is @Nonnull but is not present; " +
124+
LOGGER.log(Level.FINER, "The parameter to be set is @Nonnull but is not present; " +
125125
"setting equal to empty set.");
126126
args[i] = Collections.emptySet();
127127
} else if (List.class.isAssignableFrom(t)) {
128-
LOGGER.log(Level.INFO, "The parameter to be set is @Nonnull but is not present; " +
128+
LOGGER.log(Level.FINER, "The parameter to be set is @Nonnull but is not present; " +
129129
"setting equal to empty list.");
130130
args[i] = Collections.emptyList();
131131
} else if (String.class.isAssignableFrom(t)) {
@@ -160,7 +160,8 @@ private T tryConstructor(Constructor<T> constructor, Mapping config, Configurati
160160
final Configurator configurator = context.lookupOrFail(k);
161161
args[i] = configurator.configure(value, context);
162162
}
163-
LOGGER.info("Setting " + target + "." + names[i] + " = " + (t == Secret.class ? "****" : value));
163+
LOGGER.log(Level.FINE, "Setting {0}. {1} = {2}",
164+
new Object[] {target, names[i], t == Secret.class ? "****" : value});
164165
} else if (t.isPrimitive()) {
165166
args[i] = defaultValue(t);
166167
}

plugin/src/test/java/io/jenkins/plugins/casc/core/ProxyConfiguratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class ProxyConfiguratorTest {
3333

3434
@Rule
3535
public RuleChain chain = RuleChain
36-
.outerRule(logging.record(Logger.getLogger(Attribute.class.getName()), Level.INFO).capture(2048))
36+
.outerRule(logging.record(Logger.getLogger(Attribute.class.getName()), Level.FINER).capture(2048))
3737
.around(new EnvVarsRule())
3838
.around(j);
3939

plugin/src/test/java/io/jenkins/plugins/casc/misc/RoundTripAbstractTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void roundTripTest() throws IOException {
114114

115115
// Start recording the logs just before restarting, to avoid capture the previous startup. We're look there
116116
// if the "magic token" is there
117-
logging.record("io.jenkins.plugins.casc", Level.INFO).capture(5);
117+
logging.record("io.jenkins.plugins.casc", Level.FINER).capture(2048);
118118
});
119119

120120
r.then(step -> {

0 commit comments

Comments
 (0)