Repository: logging-log4j2 Updated Branches: refs/heads/master d17dbf5d8 -> cb95027f0
[LOG4J2-2210] Fix error log message for Script which says ScriptFile instead. Apply a more thorough change thank proposed in the PR. Closes #143. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/cb95027f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/cb95027f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/cb95027f Branch: refs/heads/master Commit: cb95027f0e5d6726b271f9f5f539e4cbc5064006 Parents: d17dbf5 Author: Gary Gregory <[email protected]> Authored: Mon Jan 22 12:05:31 2018 -0700 Committer: Gary Gregory <[email protected]> Committed: Mon Jan 22 12:05:31 2018 -0700 ---------------------------------------------------------------------- .../org/apache/logging/log4j/core/script/Script.java | 14 +++++++++----- src/changes/changes.xml | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cb95027f/log4j-core/src/main/java/org/apache/logging/log4j/core/script/Script.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/script/Script.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/script/Script.java index 86e3bd7..b33b1f2 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/script/Script.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/script/Script.java @@ -25,9 +25,13 @@ import org.apache.logging.log4j.core.config.plugins.PluginValue; /** * Container for the language and body of a script. */ -@Plugin(name = "Script", category = Node.CATEGORY, printObject = true) +@Plugin(name = Script.PLUGIN_NAME, category = Node.CATEGORY, printObject = true) public class Script extends AbstractScript { + private static final String ATTR_LANGUAGE = "language"; + private static final String ATTR_SCRIPT_TEXT = "scriptText"; + static final String PLUGIN_NAME = "Script"; + public Script(final String name, final String language, final String scriptText) { super(name, language, scriptText); } @@ -36,15 +40,15 @@ public class Script extends AbstractScript { public static Script createScript( // @formatter:off @PluginAttribute("name") final String name, - @PluginAttribute("language") String language, - @PluginValue("scriptText") final String scriptText) { + @PluginAttribute(ATTR_LANGUAGE) String language, + @PluginValue(ATTR_SCRIPT_TEXT) final String scriptText) { // @formatter:on if (language == null) { - LOGGER.info("No script language supplied, defaulting to {}", DEFAULT_LANGUAGE); + LOGGER.error("No '{}' attribute provided for {} plugin '{}'", ATTR_LANGUAGE, PLUGIN_NAME, name); language = DEFAULT_LANGUAGE; } if (scriptText == null) { - LOGGER.error("No scriptText attribute provided for ScriptFile {}", name); + LOGGER.error("No '{}' attribute provided for {} plugin '{}'", ATTR_SCRIPT_TEXT, PLUGIN_NAME, name); return null; } return new Script(name, language, scriptText); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cb95027f/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f5646b1..b2f05d5 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -128,6 +128,9 @@ <action issue="LOG4J2-2209" dev="ggregory" type="update"> Rename existing MongoDb plugin and related artifacts from MongoDb to MongoDb2. </action> + <action issue="LOG4J2-2210" dev="ggregory" type="update" due-to="Björn Kautler"> + Fix error log message for Script which says ScriptFile instead. + </action> </release> <release version="2.10.0" date="2017-11-18" description="GA Release 2.10.0"> <action issue="LOG4J2-2120" dev="mikes" type="add" due-to="Carter Douglas Kozak ">
