mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Reduces noise in the logs during development
This commit is contained in:
@@ -282,7 +282,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
|
||||
protected boolean isWithinLengthLimit( String name ) {
|
||||
boolean matchLength = name.length() <= paramNameMaxLength;
|
||||
if (!matchLength) {
|
||||
notifyDeveloper("Parameter [{}] is too long, allowed length is [{}]", name, String.valueOf(paramNameMaxLength));
|
||||
LOG.debug("Parameter [{}] is too long, allowed length is [{}]", name, String.valueOf(paramNameMaxLength));
|
||||
}
|
||||
return matchLength;
|
||||
}
|
||||
@@ -292,27 +292,19 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
|
||||
if (result.isAccepted()) {
|
||||
return true;
|
||||
}
|
||||
notifyDeveloper("Parameter [{}] didn't match accepted pattern [{}]!", paramName, result.getAcceptedPattern());
|
||||
LOG.debug("Parameter [{}] didn't match accepted pattern [{}]!", paramName, result.getAcceptedPattern());
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isExcluded(String paramName) {
|
||||
ExcludedPatternsChecker.IsExcluded result = excludedPatterns.isExcluded(paramName);
|
||||
if (result.isExcluded()) {
|
||||
notifyDeveloper("Parameter [{}] matches excluded pattern [{}]!", paramName, result.getExcludedPattern());
|
||||
LOG.debug("Parameter [{}] matches excluded pattern [{}]!", paramName, result.getExcludedPattern());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void notifyDeveloper(String message, String... parameters) {
|
||||
if (devMode) {
|
||||
LOG.warn(message, parameters);
|
||||
} else {
|
||||
LOG.debug(message, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to order the parameters or not
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user