Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C6DF181D4 for ; Wed, 15 Jul 2015 01:43:02 +0000 (UTC) Received: (qmail 18304 invoked by uid 500); 15 Jul 2015 01:43:02 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 18252 invoked by uid 500); 15 Jul 2015 01:43:02 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 18241 invoked by uid 99); 15 Jul 2015 01:43:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2015 01:43:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 36609E180F; Wed, 15 Jul 2015 01:43:01 +0000 (UTC) From: sudheeshkatkam To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request: Enhanced logging and associated code hygiene Content-Type: text/plain Message-Id: <20150715014301.36609E180F@git1-us-west.apache.org> Date: Wed, 15 Jul 2015 01:43:01 +0000 (UTC) Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/93#discussion_r34639451 --- Diff: common/src/main/java/org/apache/drill/common/config/DrillConfig.java --- @@ -138,34 +155,77 @@ public static DrillConfig create(Properties testConfigurations) { return create(null, testConfigurations, true); } - public static DrillConfig create(String overrideFileName, boolean enableServerConfigs) { - return create(overrideFileName, null, enableServerConfigs); + /** + * ... + * @param overrideFileResourcePathname + * see {@link #create(String)}'s {@code overrideFileResourcePathname} + */ + public static DrillConfig create(String overrideFileResourcePathname, boolean enableServerConfigs) { + return create(overrideFileResourcePathname, null, enableServerConfigs); } - private static DrillConfig create(String overrideFileName, Properties overriderProps, boolean enableServerConfigs) { - overrideFileName = overrideFileName == null ? CommonConstants.CONFIG_OVERRIDE : overrideFileName; - - // first we load defaults. + /** + * ... + * @param overrideFileResourcePathname + * see {@link #create(String)}'s {@code overrideFileResourcePathname} + * @param overriderProps + * optional property map for further overriding (after override file + * is assimilated + * @param enableServerConfigs + * whether to enable server-specific configuration options + * @return + */ + private static DrillConfig create(String overrideFileResourcePathname, + final Properties overriderProps, + final boolean enableServerConfigs) { + overrideFileResourcePathname = + overrideFileResourcePathname == null + ? CommonConstants.CONFIG_OVERRIDE + : overrideFileResourcePathname; + + // 1. Load defaults configuration file. Config fallback = null; final ClassLoader[] classLoaders = ClasspathHelper.classLoaders(); for (ClassLoader classLoader : classLoaders) { - if (classLoader.getResource(CommonConstants.CONFIG_DEFAULT) != null) { - fallback = ConfigFactory.load(classLoader, CommonConstants.CONFIG_DEFAULT); + final URL url = + classLoader.getResource(CommonConstants.CONFIG_DEFAULT); + if (null != url) { + logger.debug("Loading base config. file at {}.", url); + fallback = + ConfigFactory.load(classLoader, + CommonConstants.CONFIG_DEFAULT); break; } } + // 2. Load per-module configuration files. Collection urls = PathScanner.getConfigURLs(); logger.debug("Loading configs at the following URLs {}", urls); for (URL url : urls) { + logger.debug("Loading module config. file at {}.", url); fallback = ConfigFactory.parseURL(url).withFallback(fallback); } - Config effectiveConfig = ConfigFactory.load(overrideFileName).withFallback(fallback); + // 3. Load any overrides configuration file and overrides from JVM --- End diff -- overrides *from* configuration file --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---