[NO ISSUE] DEFAULT_DIR and logdir path fixes
This brings changes from 0.9.4.1-pre-rc to stabilization
Change-Id: Ie0aeae95d529c8540093642985c5fa9540ee03fd
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3192
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
index 07e61ba..79ad71f 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java
@@ -18,6 +18,7 @@
*/
package org.apache.hyracks.control.common.controllers;
+import java.io.File;
import java.io.Serializable;
import java.net.URL;
import java.util.function.Function;
@@ -40,8 +41,8 @@
CONFIG_FILE_URL(OptionTypes.URL, (URL) null, "Specify URL to master configuration file"),
DEFAULT_DIR(
OptionTypes.STRING,
- "Directory where files are written to by default",
- FileUtil.joinPath(System.getProperty(ConfigurationUtil.JAVA_IO_TMPDIR), "hyracks")),
+ FileUtil.joinPath(System.getProperty(ConfigurationUtil.JAVA_IO_TMPDIR), "hyracks"),
+ "Directory where files are written to by default"),
LOG_DIR(
OptionTypes.STRING,
(Function<IApplicationConfig, String>) appConfig -> FileUtil
@@ -120,6 +121,8 @@
}
public String getLogDir() {
- return configManager.getAppConfig().getString(ControllerConfig.Option.LOG_DIR);
+ String relPath = configManager.getAppConfig().getString(ControllerConfig.Option.LOG_DIR);
+ String fullPath = new File(relPath).getAbsolutePath();
+ return fullPath;
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
index 990d6c9..587696c 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCLogConfigurationFactory.java
@@ -30,6 +30,7 @@
import org.apache.logging.log4j.core.config.builder.api.LayoutComponentBuilder;
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
+import java.io.File;
import java.net.URI;
public class NCLogConfigurationFactory extends ConfigurationFactory {
@@ -41,7 +42,7 @@
public Configuration createConfiguration(ConfigurationBuilder<BuiltConfiguration> builder) {
String nodeId = config.getNodeId();
- String logDir = config.getLogDir();
+ File logDir = new File(config.getLogDir());
builder.setStatusLevel(Level.WARN);
builder.setConfigurationName("RollingBuilder");
// create a rolling file appender
@@ -50,10 +51,11 @@
ComponentBuilder triggeringPolicy = builder.newComponent("Policies")
.addComponent(builder.newComponent("CronTriggeringPolicy").addAttribute("schedule", "0 0 0 * * ?"))
.addComponent(builder.newComponent("SizeBasedTriggeringPolicy").addAttribute("size", "50M"));
- AppenderComponentBuilder defaultRoll =
- builder.newAppender("default", "RollingFile").addAttribute("fileName", logDir + "nc-" + nodeId + ".log")
- .addAttribute("filePattern", logDir + "nc-" + nodeId + "-%d{MM-dd-yy}.log.gz")
- .add(defaultLayout).addComponent(triggeringPolicy);
+ AppenderComponentBuilder defaultRoll = builder.newAppender("default", "RollingFile")
+ .addAttribute("fileName", new File(logDir, "nc-" + nodeId + ".log").getAbsolutePath())
+ .addAttribute("filePattern",
+ new File(logDir, "nc-" + nodeId + "-%d{MM-dd-yy}.log.gz").getAbsolutePath())
+ .add(defaultLayout).addComponent(triggeringPolicy);
builder.add(defaultRoll);
// create the new logger
@@ -61,9 +63,10 @@
LayoutComponentBuilder accessLayout = builder.newLayout("PatternLayout").addAttribute("pattern", "%m%n");
AppenderComponentBuilder accessRoll = builder.newAppender("access", "RollingFile")
- .addAttribute("fileName", logDir + "access-" + nodeId + ".log")
- .addAttribute("filePattern", logDir + "access-" + nodeId + "-%d{MM-dd-yy}.log.gz").add(accessLayout)
- .addComponent(triggeringPolicy);
+ .addAttribute("fileName", new File(logDir, "access-" + nodeId + ".log").getAbsolutePath())
+ .addAttribute("filePattern",
+ new File(logDir, "access-" + nodeId + "-%d{MM-dd-yy}.log.gz").getAbsolutePath())
+ .add(accessLayout).addComponent(triggeringPolicy);
builder.add(accessRoll);
builder.add(builder.newLogger("org.apache.hyracks.http.server.CLFLogger", Level.forName("ACCESS", 550))
.add(builder.newAppenderRef("access")).addAttribute("additivity", false));