Eli Mesika has uploaded a new change for review. Change subject: tools: remove log4j usage from engine-config ......................................................................
tools: remove log4j usage from engine-config This patch removes logging using log4j from engine_config in order not to fail on logging to /var/log when engine-config is not executed as a root. Change-Id: I8cc4eadac817e0527d1286e277b4500f83526c6f Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1063901 Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfig.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigCLIParser.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/ConfigKeyFactory.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/GetValidator.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/SetValidator.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/ToolConsole.java M packaging/bin/engine-config.sh 11 files changed, 23 insertions(+), 143 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/05/26305/1 diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java index 972faf4..9fc69f2 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java @@ -9,7 +9,6 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; /** * This class stores the local configuration (understanding local as the @@ -18,8 +17,6 @@ * <code>ENGINE_VARS</code> environment variable. */ public class EngineLocalConfig extends LocalConfig { - // The log: - private static final Logger log = Logger.getLogger(EngineLocalConfig.class); // Default files for defaults and overridden values: private static final String DEFAULTS_PATH = "/usr/share/ovirt-engine/conf/engine.conf.defaults"; diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java index 9005d38..5fe27b5 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java @@ -9,17 +9,14 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; /** * This class stores the local configuration (understanding local as the @@ -28,8 +25,6 @@ * <code>ENGINE_VARS</code> environment variable. */ public class LocalConfig { - // The log: - private static final Logger log = Logger.getLogger(LocalConfig.class); private static final String SENSITIVE_KEYS = "SENSITIVE_KEYS"; @@ -46,7 +41,6 @@ */ protected void setConfig(Map<String, String> values) { this.values = values; - dumpConfig(); } /** @@ -104,32 +98,7 @@ } catch (IOException exception) { String message = "Can't load configuration file."; - log.error(message, exception); throw new IllegalStateException(message, exception); - } - } - - dumpConfig(); - } - - /** - * Dump all configuration to the log. - * this should probably be DEBUG, but as it will usually happen only once, - * during the startup, is not that a roblem to use INFO. - */ - private void dumpConfig() { - if (log.isInfoEnabled()) { - Set<String> keys = values.keySet(); - List<String> list = new ArrayList<String>(keys.size()); - List<String> sensitiveKeys = Arrays.asList(getSensitiveKeys()); - list.addAll(keys); - Collections.sort(list); - for (String key : list) { - String value = "***"; - if (!sensitiveKeys.contains(key)) { - value = values.get(key); - } - log.info("Value of property \"" + key + "\" is \"" + value + "\"."); } } } @@ -144,7 +113,6 @@ private void loadProperties(File file) throws IOException { // Do nothing if the file doesn't exist or isn't readable: if (!file.canRead()) { - log.info("The file \"" + file.getAbsolutePath() + "\" doesn't exist or isn't readable. Will return an empty set of properties."); return; } @@ -158,7 +126,6 @@ index++; loadLine(line); } - log.info("Loaded file \"" + file.getAbsolutePath() + "\"."); } catch (Exception e) { String msg = String.format( @@ -167,7 +134,6 @@ index, e ); - log.error(msg, e); throw new RuntimeException(msg, e); } } @@ -301,7 +267,6 @@ if (value == null && !allowMissing) { // Loudly alert in the log and throw an exception: String message = "The property \"" + key + "\" doesn't have a value."; - log.error(message); throw new IllegalArgumentException(message); // Or maybe kill ourselves, as a missing configuration parameter is @@ -364,7 +329,6 @@ // No luck, will alert in the log that the text is not valid and throw // an exception: String message = "The value \"" + value + "\" for property \"" + key + "\" is not a valid boolean."; - log.error(message); throw new IllegalArgumentException(message); } } @@ -412,7 +376,6 @@ } catch (NumberFormatException exception) { String message = "The value \"" + value + "\" for property \"" + key + "\" is not a valid integer."; - log.error(message, exception); throw new IllegalArgumentException(message, exception); } } @@ -458,7 +421,6 @@ } catch (NumberFormatException exception) { String message = "The value \"" + value + "\" for property \"" + key + "\" is not a valid long integer."; - log.error(message, exception); throw new IllegalArgumentException(message, exception); } } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfig.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfig.java index 1a3b419..fd7b32b 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfig.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfig.java @@ -1,15 +1,7 @@ package org.ovirt.engine.core.config; import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.parsers.FactoryConfigurationError; - -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.xml.DOMConfigurator; import org.ovirt.engine.core.config.validation.ConfigActionType; import org.ovirt.engine.core.tools.ToolConsole; import org.ovirt.engine.core.utils.EngineLocalConfig; @@ -18,8 +10,6 @@ * The <code>EngineConfig</code> class represents the main class of the EngineConfig tool. */ public class EngineConfig { - // The log: - private static final Logger log = Logger.getLogger(EngineConfig.class); // The console: private static final ToolConsole console = ToolConsole.getInstance(); @@ -44,27 +34,10 @@ */ public void setUpAndExecute(String... args) throws Exception { parser.parse(args); - log.debug("Arguments have been parsed: " + parser.engineConfigMapToString()); ConfigActionType actionType = parser.getConfigAction(); actionType.validate(parser.getEngineConfigMap()); setEngineConfigLogic(new EngineConfigLogic(parser)); engineConfigLogic.execute(); - } - - /** - * Initializes logging configuration - */ - private static void initLogging() { - String cfgFile = System.getProperty("log4j.configuration"); - if (StringUtils.isNotBlank(cfgFile)) { - try { - URL url = new URL(cfgFile); - LogManager.resetConfiguration(); - DOMConfigurator.configure(url); - } catch (FactoryConfigurationError | MalformedURLException ex) { - System.out.println("Cannot configure logging: " + ex.getMessage()); - } - } } /** @@ -74,13 +47,11 @@ * The arguments given by the user. */ public static void main(String... args) { - initLogging(); try { getInstance().setParser(new EngineConfigCLIParser()); getInstance().setUpAndExecute(args); } catch (Throwable t) { - log.debug("Exiting with error: ", t); console.writeErrorLine(t.getMessage()); System.exit(1); } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigCLIParser.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigCLIParser.java index 976e426..5666951 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigCLIParser.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigCLIParser.java @@ -2,8 +2,8 @@ import java.util.HashMap; -import org.apache.log4j.Logger; import org.ovirt.engine.core.config.validation.ConfigActionType; +import org.ovirt.engine.core.tools.ToolConsole; /** * The <code>EngineConfigCLIParser</code> class represents a parser for the EngineConfig tool. It parses the given @@ -11,8 +11,9 @@ * not as a char that is actually part of a key/value. */ public class EngineConfigCLIParser { - // The log: - private static final Logger log = Logger.getLogger(EngineConfigCLIParser.class); + + // The console: + private static final ToolConsole console = ToolConsole.getInstance(); private HashMap<String, String> argsMap = new HashMap<String, String>(); private EngineConfigMap engineConfigMap = new EngineConfigMap(); @@ -30,16 +31,13 @@ * but action is not 'set'. */ public void parse(String[] args) { - log.debug("parse: beginning to parse passed arguments."); validateNonEmpty(args); parseAction(args); parseArguments(args); - log.debug("parse: Finished parsing arguments."); } private void validateNonEmpty(String[] args) { if (args.length == 0) { - log.debug("parse error: no arguments given."); throw (new IllegalArgumentException("Error: at least 1 argument needed for configuration utility to run.")); } } @@ -68,11 +66,11 @@ argsMap.put(key, args[currentIndex + 1]); fShouldSkip = true; } else { - log.debug("parsing error: missing pair for key " + args[currentIndex] + ". Skipping argument."); + console.writeLine("parsing error: missing pair for key " + args[currentIndex] + ". Skipping argument."); } } } else { - log.debug("parsing error: illegal argument " + args[currentIndex] + ", starts with '='. Skipping argument."); + console.writeLine("parsing error: illegal argument " + args[currentIndex] + ", starts with '='. Skipping argument."); } return fShouldSkip; } @@ -107,10 +105,10 @@ && getKey() == null) { engineConfigMap.setKey(arg); // sets the key in 'get' action with format: "-g key" } else { - log.debug("parsing error: illegal argument " + arg + ". Skipping argument."); + console.writeLine("parsing error: illegal argument " + arg + ". Skipping argument."); } } else { - log.debug("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); + console.writeLine("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); } } @@ -124,8 +122,6 @@ engineConfigMap.setKey(key); engineConfigMap.setValue(value); } else { - log.debug("parseArguments error: second argument '" - + arg + "' has an '=' char but action is not 'set'."); throw new IllegalArgumentException("Illegal second argument: " + arg + "."); } } @@ -156,7 +152,7 @@ } else if (currentIndex == 1) { parseSecondArgWithoutDash(args[currentIndex], passFileExists); } else { - log.debug("parseArguments error: Skipping argument " + args[currentIndex] + "."); + console.writeLine("parseArguments error: Skipping argument " + args[currentIndex] + "."); } } fillEngineConfigMap(); @@ -181,7 +177,6 @@ handleActionWithoutKey(action); } } else { - log.debug("parseAction error: Illegal first argument: '" + args[0] + "' - not a legal action."); throw new IllegalArgumentException("Action verb must come first, and '" + args[0] + "' is not an action.\nPlease tell me what to do: list? get? set? get-all?"); } @@ -223,7 +218,6 @@ private void handleActionWithoutKey(String action) { engineConfigMap.setConfigAction(ConfigActionType.getActionType(action)); if (getConfigAction() == null) { - log.debug("parseAction error: Illegal first argument: '" + action + "' - not a legal action."); throw new IllegalArgumentException("Action verb must come first, and '" + action + "' is not an action.\nPlease tell me what to do: list? get? set? get-all?"); } @@ -241,7 +235,6 @@ if (action.equals("--get") || action.equals("--help")) { engineConfigMap.setKey(key); } else { - log.debug("parseAction error: first argument is illegal."); throw new IllegalArgumentException("Action verb must come first, and '" + action + '=' + key + "' is not an action.\nPlease tell me what to do: list? get? set? get-all?"); } @@ -253,9 +246,8 @@ * @param arg */ private void validateArgStartsWithDash(String arg) { - log.debug("Validating arrgument" + arg); if (!arg.startsWith("-")) { - log.debug("parseAction error: first argument '" + arg + "' did not start with '-' or '--'."); + console.writeLine("parseAction error: first argument '" + arg + "' did not start with '-' or '--'."); throw (new IllegalArgumentException("First argument must be an action, and start with '-' or '--'")); } } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java index 0705d6c..ce4476f 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java @@ -17,7 +17,6 @@ import org.apache.commons.configuration.SubnodeConfiguration; import org.apache.commons.configuration.tree.ConfigurationNode; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.ovirt.engine.core.config.db.ConfigDAO; import org.ovirt.engine.core.config.db.ConfigDaoImpl; import org.ovirt.engine.core.config.entity.ConfigKey; @@ -29,8 +28,6 @@ * The <code>EngineConfigLogic</code> class is responsible for the logic of the EngineConfig tool. */ public class EngineConfigLogic { - // The log: - private static final Logger log = Logger.getLogger(EngineConfigLogic.class); // The console: private static final ToolConsole console = ToolConsole.getInstance(); @@ -56,7 +53,6 @@ * @throws Exception */ private void init() throws Exception { - log.debug("init: beginning initiation of EngineConfigLogic"); appConfig = new AppConfig(parser.getAlternateConfigFile()).getFile(); keysConfig = new KeysConfig<HierarchicalConfiguration>(parser.getAlternatePropertiesFile()).getFile(); populateAlternateKeyMap(keysConfig); @@ -65,7 +61,6 @@ try { this.configDAO = new ConfigDaoImpl(appConfig); } catch (SQLException se) { - log.debug("init: caught connection error. Error details: ", se); throw new ConnectException("Connection to the Database failed. Please check that the hostname and port number are correct and that the Database service is up and running."); } } @@ -90,8 +85,6 @@ */ public void execute() throws Exception { ConfigActionType actionType = parser.getConfigAction(); - log.debug("execute: beginning execution of action " + actionType + "."); - switch (actionType) { case ACTION_ALL: printAllValues(); @@ -112,7 +105,6 @@ reloadConfigurations(); break; default: // Should have already been discovered before execute - log.debug("execute: unable to recognize action: " + actionType + "."); throw new UnsupportedOperationException("Please tell me what to do: list? get? set? get-all? reload?"); } } @@ -179,7 +171,6 @@ * @throws IOException */ private String startUserDialog() throws IOException { - log.debug("starting user dialog."); String user = null; while (StringUtils.isBlank(user)) { console.writeLine("Please enter user: "); @@ -198,7 +189,6 @@ } public static String startPasswordDialog(String user, String msg) throws IOException { - log.debug("starting password dialog."); String prompt = null; if (user != null) { prompt = msg + " for " + user + ": "; @@ -217,7 +207,6 @@ private void printAllValuesForKey(String key) throws Exception { List<ConfigKey> keysForName = getConfigDAO().getKeysForName(key); if (keysForName.size() == 0) { - log.debug("Failed to fetch value for key \"" + key + "\", no such entry with default version."); throw new RuntimeException("Error fetching " + key + " value: no such entry with default version."); } @@ -251,7 +240,7 @@ printAllValuesForKey(key.getKey()); } catch (Exception exception) { - log.error("Error while retriving value for key \"" + key.getKey() + "\".", exception); + console.writeLine("Error while retriving value for key \"" + key.getKey() + "\"." + exception); } } } @@ -337,7 +326,6 @@ private void printKeyWithSpecifiedVersion(String key, String version) throws Exception { ConfigKey configKey = fetchConfigKey(key, version); if (configKey == null || configKey.getKey() == null) { - log.debug("getValue: error fetching " + key + " value: no such entry with version '" + version + "'."); throw new RuntimeException("Error fetching " + key + " value: no such entry with version '" + version + "'."); } @@ -363,8 +351,6 @@ } boolean sucessUpdate = persist(key, value, version); if (!sucessUpdate) { - log.debug("setValue: error setting " + key + "'s value. No such entry" - + (version == null ? "" : " with version " + version) + "."); throw new IllegalArgumentException("Error setting " + key + "'s value. No such entry" + (version == null ? "" : " with version " + version) + "."); } @@ -403,7 +389,6 @@ * @throws SQLException */ private String startVersionDialog(String key) throws IOException, SQLException { - log.debug("starting version dialog."); String version = null; List<ConfigKey> keys = configDAO.getKeysForName(key); if (keys.size() == 1) { @@ -456,11 +441,9 @@ ); } } catch (Exception e) { - message = "Error setting " + key + "'s value. " + e.getMessage(); - log.debug("Error details: ", e); + console.writeLine("Error details: Error setting " + key + "'s value. " + e.getMessage() + e); } if (message != null) { - log.debug(message); throw new IllegalAccessException(message); } @@ -476,7 +459,7 @@ ckReturn = configKeyFactory.generateByPropertiesKey(key); if (ckReturn == null || ckReturn.getKey() == null) { ckReturn = null; - log.debug("getConfigKey: Unable to fetch the value of " + key + "."); + console.writeLine("getConfigKey: Unable to fetch the value of " + key + "."); } return ckReturn; @@ -485,11 +468,10 @@ public ConfigKey fetchConfigKey(String key, String version) { ConfigKey configKey = getConfigKey(key); if (configKey == null || configKey.getKey() == null) { - log.debug("Unable to fetch the value of " + key + " in version " + version); + console.writeLine("Unable to fetch the value of " + key + " in version " + version); return null; } configKey.setVersion(version); - log.debug("Fetching key=" + configKey.getKey() + " ver=" + version); try { return getConfigDAO().getKey(configKey); } catch (SQLException e) { diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/ConfigKeyFactory.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/ConfigKeyFactory.java index cea1b7e..a1ef29f 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/ConfigKeyFactory.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/ConfigKeyFactory.java @@ -3,16 +3,19 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; + import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.commons.configuration.SubnodeConfiguration; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.ovirt.engine.core.config.EngineConfig; import org.ovirt.engine.core.config.EngineConfigCLIParser; import org.ovirt.engine.core.config.entity.helper.StringValueHelper; import org.ovirt.engine.core.config.entity.helper.ValueHelper; +import org.ovirt.engine.core.tools.ToolConsole; public class ConfigKeyFactory { + + // The console: + private static final ToolConsole console = ToolConsole.getInstance(); private HierarchicalConfiguration keysConfig; private Map<String, String> alternateKeysMap; @@ -86,7 +89,7 @@ valueHelper = (ValueHelper) cls.newInstance(); } catch (Exception e) { // failed finding a helper for this type. Setting default string type - Logger.getLogger(EngineConfig.class).debug("Unable to find " + type + " type. Using default string type."); + console.writeLine("Unable to find " + type + " type. Using default string type."); valueHelper = new StringValueHelper(); } return valueHelper; diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java index df93961..2bae931 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java @@ -5,7 +5,6 @@ import java.security.GeneralSecurityException; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.ovirt.engine.core.config.EngineConfigCLIParser; import org.ovirt.engine.core.config.EngineConfigLogic; import org.ovirt.engine.core.config.entity.ConfigKey; @@ -13,8 +12,6 @@ import org.ovirt.engine.core.utils.crypt.EngineEncryptionUtils; public class PasswordValueHelper implements ValueHelper { - // The log: - private static final Logger log = Logger.getLogger(PasswordValueHelper.class); // The console: private static final ToolConsole console = ToolConsole.getInstance(); @@ -48,8 +45,7 @@ } catch (Exception exception) { String msg = "Failed to decrypt the current value."; - console.writeLine(msg); - log.error(exception); + console.writeLine(msg + exception); throw new GeneralSecurityException(msg); } } @@ -77,8 +73,7 @@ } catch (Throwable exception) { String msg = "Failed to encrypt the current value."; - console.writeLine(msg); - log.error(msg, exception); + console.writeLine(msg + exception); throw new GeneralSecurityException(msg); } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/GetValidator.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/GetValidator.java index 743ecc5..1c67d43 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/GetValidator.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/GetValidator.java @@ -1,11 +1,8 @@ package org.ovirt.engine.core.config.validation; -import org.apache.log4j.Logger; import org.ovirt.engine.core.config.EngineConfigMap; public class GetValidator implements EngineConfigValidator { - - private final static Logger log = Logger.getLogger(GetValidator.class); /** * Validates that the 'get' action has a key. @@ -16,7 +13,6 @@ @Override public void validate(ConfigActionType actionType, EngineConfigMap engineConfigMap) throws IllegalArgumentException { if (engineConfigMap.getKey() == null) { - log.debug("validator for 'get' action: Missing key for get action."); throw new IllegalArgumentException("Missing key for get action."); } } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/SetValidator.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/SetValidator.java index ec2170a..2d1b0cc 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/SetValidator.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/validation/SetValidator.java @@ -1,14 +1,11 @@ package org.ovirt.engine.core.config.validation; -import org.apache.log4j.Logger; import org.ovirt.engine.core.config.EngineConfigMap; /** * The <code>KeyValidator</code> class is a action specific validator for the 'set' action. */ public class SetValidator implements EngineConfigValidator { - - private final static Logger log = Logger.getLogger(SetValidator.class); /** * Validates that the 'set' action has a key and value. @@ -18,7 +15,6 @@ @Override public void validate(ConfigActionType actionType, EngineConfigMap engineConfigMap) throws IllegalArgumentException { if (engineConfigMap.getKey() == null || engineConfigMap.getValue() == null) { - log.debug("validator for 'set' action: Missing key or value for set action."); throw new IllegalArgumentException("Missing key or value" + " for set action, make sure arguments are in proper order."); } diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/ToolConsole.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/ToolConsole.java index 146f57a..9b02036 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/ToolConsole.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/ToolConsole.java @@ -2,8 +2,6 @@ import java.io.IOException; -import org.apache.log4j.Logger; - /** * This class is intended to handle the regular input and output generated by * the tools and destined usually to human users. Output will be sent to the @@ -13,7 +11,7 @@ */ public class ToolConsole { // The log: - private static final Logger log = Logger.getLogger(ToolConsole.class); + //\\private static final Logger log = Logger.getLogger(ToolConsole.class); // This is a singleton and this is the instance: private static final ToolConsole instance = new ToolConsole(); @@ -35,7 +33,6 @@ public void write(Object what) { System.out.print(what); System.out.flush(); - log.info("Written to standard output \"" + what + "\"."); } /** @@ -79,7 +76,6 @@ public void writePassword(char[] password) { System.out.print(password); System.out.flush(); - log.info("Written password to standard output."); } /** @@ -91,7 +87,6 @@ public void writeError(Object what) { System.err.print(what); System.err.flush(); - log.info("Written to standard error \"" + what + "\"."); } /** @@ -136,11 +131,6 @@ character = System.in.read(); } catch (IOException exception) { - log.error( - "Error while reading line from standard input. Will " + - "consider it the end of the line and continue.", - exception - ); break; } if (character == -1 || character == '\n') { @@ -149,7 +139,6 @@ buffer.append((char) character); } String line = buffer.toString(); - log.info("Read from stdin \"" + line + "\"."); return line; } @@ -158,8 +147,6 @@ */ public char[] readPassword(String prompt) { char[] password = System.console().readPassword(prompt); - log.info("Written to console \"" + prompt + "\"."); - log.info("Read password from console."); return password; } } diff --git a/packaging/bin/engine-config.sh b/packaging/bin/engine-config.sh index 56ea1d1..a6ad5b0 100755 --- a/packaging/bin/engine-config.sh +++ b/packaging/bin/engine-config.sh @@ -98,7 +98,6 @@ # exec "${JAVA_HOME}/bin/java" \ - -Dlog4j.configuration="file:${ENGINE_ETC}/engine-config/log4j.xml" \ -Djboss.modules.write-indexes=false \ -jar "${JBOSS_HOME}/jboss-modules.jar" \ -dependencies org.ovirt.engine.core.tools \ -- To view, visit http://gerrit.ovirt.org/26305 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cc4eadac817e0527d1286e277b4500f83526c6f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
