Skip to content

Commit

Permalink
Update log messages that indicate wrong config values from FINER to W…
Browse files Browse the repository at this point in the history
…ARNING
  • Loading branch information
Channyboy committed Oct 11, 2023
1 parent 339f90d commit 0136263
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ public static Collection<HistogramBucketConfiguration> parse(String input) {
if (s.matches("[0-9]+[.]*[0-9]*")) {
return Double.parseDouble(s);
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
return null;
}
}).filter(x -> x != null).toArray(Double[]::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public static Collection<HistogramBucketMaxConfiguration> parse(String input) {
Double value = Double.parseDouble(keyValueSplit[1].trim());
metricBucketConfiguration = new HistogramBucketMaxConfiguration(metricName, value);
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { keyValueSplit[1], MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { keyValueSplit[1], MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
}
} else {
//either no value.. or too many values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public static Collection<HistogramBucketMinConfiguration> parse(String input) {
Double value = Double.parseDouble(keyValueSplit[1].trim());
metricBucketConfiguration = new HistogramBucketMinConfiguration(metricName, value);
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { keyValueSplit[1], MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer "
+ "and decimal values are accepted.",
new Object[] { keyValueSplit[1], MetricsConfigurationManager.MP_HISTOGRAM_BUCKET_PROP });
}
} else {
//either no value.. or too many values through improper syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ public static Collection<MetricPercentileConfiguration> parseMetricPercentiles(S
if (s.matches("[0][.][0-9]+")) {
return Double.parseDouble(s);
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only values 0.0-1.0 inclusively are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_PERCENTILES_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only values 0.0-1.0 inclusively are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_PERCENTILES_PROP });
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ public static Collection<TimerBucketConfiguration> parse(String input) {
} else if (s.matches("[0-9]+")) {
return Duration.ofMillis(Long.parseLong(s));
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
return null;
}
}).filter(s -> s != null).toArray(Duration[]::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ public static Collection<TimerBucketMaxConfiguration> parse(String input) {
} else if (s.matches("[0-9]+")) {
dur = Duration.ofMillis(Long.parseLong(s));
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ public static Collection<TimerBucketMinConfiguration> parse(String input) {
} else if (s.matches("[0-9]+")) {
dur = Duration.ofMillis(Long.parseLong(s));
} else {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.logp(Level.FINER, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
}
LOGGER.logp(Level.WARNING, CLASS_NAME, null,
"The value \"{0}\" is invalid for the \"{1}\" property. Only integer values with an "
+ "optional time unit (e.g. ms,s,m,h) are accepted.",
new Object[] { s, MetricsConfigurationManager.MP_TIMER_BUCKET_PROP });
}

} else {
Expand Down

0 comments on commit 0136263

Please sign in to comment.