diff --git a/main/ant-kit/pom.xml b/main/ant-kit/pom.xml
index 77fa507ff..be78f8f92 100644
--- a/main/ant-kit/pom.xml
+++ b/main/ant-kit/pom.xml
@@ -8,7 +8,7 @@
org.cryptomator
main
- 1.3.0-rc5
+ 1.3.0-rc6
ant-kit
pom
diff --git a/main/ant-kit/src/main/resources/build.xml b/main/ant-kit/src/main/resources/build.xml
index 55b8624a1..fe51625c9 100644
--- a/main/ant-kit/src/main/resources/build.xml
+++ b/main/ant-kit/src/main/resources/build.xml
@@ -29,13 +29,13 @@
-
-
+
+
@@ -53,13 +53,13 @@
-
-
+
+
diff --git a/main/ant-kit/src/main/resources/logback.xml b/main/ant-kit/src/main/resources/logback.xml
new file mode 100644
index 000000000..193766d57
--- /dev/null
+++ b/main/ant-kit/src/main/resources/logback.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+ ${user.home}/.Cryptomator/cryptomator.log
+ false
+
+ ${user.home}/.Cryptomator/cryptomator%i.log
+ 0
+ 9
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+ ${user.home}/.Cryptomator/cryptomator.log
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/main/commons/pom.xml b/main/commons/pom.xml
index 31e5e7188..8ac4900df 100644
--- a/main/commons/pom.xml
+++ b/main/commons/pom.xml
@@ -10,7 +10,7 @@
org.cryptomator
main
- 1.3.0-rc5
+ 1.3.0-rc6
commons
Cryptomator Commons
@@ -40,11 +40,6 @@
com.google.dagger
dagger
-
- com.google.dagger
- dagger-compiler
- provided
-
diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/SettingsProvider.java b/main/commons/src/main/java/org/cryptomator/common/settings/SettingsProvider.java
index 2974252db..dfb701489 100644
--- a/main/commons/src/main/java/org/cryptomator/common/settings/SettingsProvider.java
+++ b/main/commons/src/main/java/org/cryptomator/common/settings/SettingsProvider.java
@@ -97,6 +97,9 @@ public class SettingsProvider implements Provider {
try (InputStream in = Files.newInputStream(settingsPath, StandardOpenOption.READ); //
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) {
settings = gson.fromJson(reader, Settings.class);
+ if (settings == null) {
+ throw new IOException("Unexpected EOF");
+ }
LOG.info("Settings loaded from " + settingsPath);
} catch (IOException e) {
LOG.info("Failed to load settings, creating new one.");
diff --git a/main/jacoco-report/pom.xml b/main/jacoco-report/pom.xml
index b549d9abc..62749fd3d 100644
--- a/main/jacoco-report/pom.xml
+++ b/main/jacoco-report/pom.xml
@@ -5,7 +5,7 @@
org.cryptomator
main
- 1.3.0-rc5
+ 1.3.0-rc6
jacoco-report
Cryptomator Code Coverage Report
diff --git a/main/keychain/pom.xml b/main/keychain/pom.xml
index 48fc97ced..2f19f9c57 100644
--- a/main/keychain/pom.xml
+++ b/main/keychain/pom.xml
@@ -3,7 +3,7 @@
org.cryptomator
main
- 1.3.0-rc5
+ 1.3.0-rc6
keychain
System Keychain Access
@@ -25,17 +25,18 @@
org.cryptomator
jni
+
+
+
+ com.google.guava
+ guava
+
com.google.dagger
dagger
-
- com.google.dagger
- dagger-compiler
- provided
-
diff --git a/main/launcher/pom.xml b/main/launcher/pom.xml
index 55b4305bc..c0420d976 100644
--- a/main/launcher/pom.xml
+++ b/main/launcher/pom.xml
@@ -4,7 +4,7 @@
org.cryptomator
main
- 1.3.0-rc5
+ 1.3.0-rc6
launcher
Cryptomator Launcher
@@ -34,24 +34,15 @@
com.google.dagger
dagger
-
- com.google.dagger
- dagger-compiler
- provided
-
- org.apache.logging.log4j
- log4j-core
+ ch.qos.logback
+ logback-core
- org.apache.logging.log4j
- log4j-slf4j-impl
-
-
- org.apache.logging.log4j
- log4j-jul
+ ch.qos.logback
+ logback-classic
\ No newline at end of file
diff --git a/main/launcher/src/main/java/org/cryptomator/launcher/InterProcessCommunicator.java b/main/launcher/src/main/java/org/cryptomator/launcher/InterProcessCommunicator.java
index ed72e17be..71ea758e2 100644
--- a/main/launcher/src/main/java/org/cryptomator/launcher/InterProcessCommunicator.java
+++ b/main/launcher/src/main/java/org/cryptomator/launcher/InterProcessCommunicator.java
@@ -49,6 +49,7 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
// visible for testing
static InterProcessCommunicator start(Path portFilePath, InterProcessCommunicationProtocol endpoint) throws IOException {
+ System.setProperty("java.rmi.server.hostname", "localhost");
// try to connect to existing server:
int port = readPort(portFilePath);
LOG.debug("Connecting to running process on TCP port {}...", port);
@@ -95,7 +96,7 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
if (port == 0) {
throw new ConnectException("Can not connect to port 0.");
}
- Registry registry = LocateRegistry.getRegistry(port);
+ Registry registry = LocateRegistry.getRegistry("localhost", port);
this.remote = (IpcProtocolRemote) registry.lookup(RMI_NAME);
}
@@ -127,7 +128,7 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
private final IpcProtocolRemoteImpl remote;
private ServerCommunicator(InterProcessCommunicationProtocol delegate) throws IOException {
- this.socket = new ServerSocket(0, Byte.MAX_VALUE, InetAddress.getLocalHost());
+ this.socket = new ServerSocket(0, Byte.MAX_VALUE, InetAddress.getByName("localhost"));
RMIClientSocketFactory csf = RMISocketFactory.getDefaultSocketFactory();
SingletonServerSocketFactory ssf = new SingletonServerSocketFactory(socket);
this.registry = LocateRegistry.createRegistry(0, csf, ssf);
diff --git a/main/launcher/src/main/java/org/cryptomator/logging/ConfigurableFileAppender.java b/main/launcher/src/main/java/org/cryptomator/logging/ConfigurableFileAppender.java
deleted file mode 100644
index a453b1adf..000000000
--- a/main/launcher/src/main/java/org/cryptomator/logging/ConfigurableFileAppender.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 Sebastian Stenzel and others.
- * This file is licensed under the terms of the MIT license.
- * See the LICENSE.txt file for more info.
- *
- * Contributors:
- * Sebastian Stenzel - initial API and implementation
- *******************************************************************************/
-package org.cryptomator.logging;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.URISyntaxException;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang3.SystemUtils;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.Core;
-import org.apache.logging.log4j.core.Filter;
-import org.apache.logging.log4j.core.Layout;
-import org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender;
-import org.apache.logging.log4j.core.appender.FileManager;
-import org.apache.logging.log4j.core.config.plugins.Plugin;
-import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute;
-import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory;
-import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required;
-import org.apache.logging.log4j.util.Strings;
-
-/**
- * A preconfigured FileAppender only relying on a configurable system property, e.g. -Dcryptomator.logPath=/var/log/cryptomator.log.
- * Other than the normal {@link org.apache.logging.log4j.core.appender.FileAppender} paths can be resolved relative to the users home directory.
- */
-@Plugin(name = ConfigurableFileAppender.PLUGIN_NAME, category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = true)
-public class ConfigurableFileAppender extends AbstractOutputStreamAppender {
-
- static final String PLUGIN_NAME = "ConfigurableFile";
- private static final Pattern DRIVE_LETTER_WITH_PRECEEDING_SLASH = Pattern.compile("^/[A-Z]:", Pattern.CASE_INSENSITIVE);
-
- private ConfigurableFileAppender(String name, Layout extends Serializable> layout, Filter filter, boolean ignoreExceptions, boolean immediateFlush, FileManager manager) {
- super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
- LOGGER.info("Logging to " + manager.getFileName());
- }
-
- @PluginBuilderFactory
- public static > B newBuilder() {
- return new Builder().asBuilder();
- }
-
- /**
- * Builds ConfigurableFileAppender instances.
- *
- * @param
- * The type to build
- */
- public static class Builder> extends AbstractOutputStreamAppender.Builder //
- implements org.apache.logging.log4j.core.util.Builder {
-
- @Required(message = "No system property name containing the log file path provided.")
- @PluginBuilderAttribute("pathPropertyName")
- private String pathPropertyName;
-
- @PluginBuilderAttribute
- private boolean append = true;
-
- @Override
- public ConfigurableFileAppender build() {
- final String pathProperty = System.getProperty(pathPropertyName);
- if (Strings.isEmpty(pathProperty)) {
- LOGGER.warn("No log file location provided in system property \"" + pathPropertyName + "\"");
- return null;
- }
-
- final Path filePath = parsePath(pathProperty);
- if (filePath == null) {
- LOGGER.warn("Invalid path \"" + pathProperty + "\"");
- return null;
- }
-
- if (!Files.exists(filePath.getParent())) {
- try {
- Files.createDirectories(filePath.getParent());
- } catch (IOException e) {
- LOGGER.error("Could not create parent directories for log file located at " + filePath.toString(), e);
- return null;
- }
- }
-
- FileManager manager = FileManager.getFileManager(filePath.toString(), append, false, isBufferedIo(), true, null, getOrCreateLayout(), getBufferSize(), getConfiguration());
- return new ConfigurableFileAppender(getName(), getLayout(), getFilter(), isIgnoreExceptions(), isImmediateFlush(), manager);
- }
-
- public B withPathPropertyName(String pathPropertyName) {
- this.pathPropertyName = pathPropertyName;
- return asBuilder();
- }
-
- public B withAppend(boolean append) {
- this.append = append;
- return asBuilder();
- }
-
- }
-
- private static Path parsePath(String path) {
- if (path.startsWith("~/")) {
- // home-dir-relative Path:
- final Path userHome = FileSystems.getDefault().getPath(SystemUtils.USER_HOME);
- return userHome.resolve(path.substring(2));
- } else if (path.startsWith("/")) {
- // absolute Path:
- return FileSystems.getDefault().getPath(path);
- } else {
- // relative Path:
- try {
- String jarFileLocation = ConfigurableFileAppender.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
- if (SystemUtils.IS_OS_WINDOWS && DRIVE_LETTER_WITH_PRECEEDING_SLASH.matcher(jarFileLocation).find()) {
- // on windows we need to remove a preceeding slash from "/C:/foo/bar":
- jarFileLocation = jarFileLocation.substring(1);
- }
- final Path workingDir = FileSystems.getDefault().getPath(jarFileLocation).getParent();
- return workingDir.resolve(path);
- } catch (URISyntaxException e) {
- LOGGER.error("Unable to resolve working directory ", e);
- return null;
- }
- }
- }
-
-}
diff --git a/main/launcher/src/main/java/org/cryptomator/logging/DebugMode.java b/main/launcher/src/main/java/org/cryptomator/logging/DebugMode.java
index baa6c94f5..b66a4b75f 100644
--- a/main/launcher/src/main/java/org/cryptomator/logging/DebugMode.java
+++ b/main/launcher/src/main/java/org/cryptomator/logging/DebugMode.java
@@ -6,29 +6,27 @@
package org.cryptomator.logging;
import static java.util.Arrays.asList;
-import static org.apache.logging.log4j.LogManager.ROOT_LOGGER_NAME;
import java.util.Collection;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.LoggerConfig;
import org.cryptomator.common.settings.Settings;
-import org.slf4j.Logger;
+import org.slf4j.ILoggerFactory;
import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+
@Singleton
public class DebugMode {
- private static final Logger LOG = LoggerFactory.getLogger(DebugMode.class);
+ private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(DebugMode.class);
private static final Collection LOGGER_UPGRADES = asList( //
- loggerUpgrade(ROOT_LOGGER_NAME, Level.INFO), //
+ loggerUpgrade(org.slf4j.Logger.ROOT_LOGGER_NAME, Level.INFO), //
loggerUpgrade("org.cryptomator", Level.TRACE), //
loggerUpgrade("org.eclipse.jetty.server.Server", Level.DEBUG) //
);
@@ -48,10 +46,13 @@ public class DebugMode {
}
private void enable() {
- LoggerContext context = (LoggerContext) LogManager.getContext(false);
- Configuration config = context.getConfiguration();
- LOGGER_UPGRADES.forEach(loggerUpgrade -> loggerUpgrade.execute(config));
- context.updateLoggers();
+ ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
+ if (loggerFactory instanceof LoggerContext) {
+ LoggerContext context = (LoggerContext) loggerFactory;
+ LOGGER_UPGRADES.forEach(loggerUpgrade -> loggerUpgrade.execute(context));
+ } else {
+ LOG.warn("SLF4J not bound to Logback.");
+ }
}
private static LoggerUpgrade loggerUpgrade(String loggerName, Level minLevel) {
@@ -68,10 +69,10 @@ public class DebugMode {
this.level = minLevel;
}
- public void execute(Configuration config) {
- LoggerConfig loggerConfig = config.getLoggerConfig(loggerName);
- if (loggerConfig.getLevel().isMoreSpecificThan(level)) {
- loggerConfig.setLevel(level);
+ public void execute(LoggerContext context) {
+ Logger logger = context.getLogger(loggerName);
+ if (logger != null && logger.getEffectiveLevel().isGreaterOrEqual(level)) {
+ logger.setLevel(level);
}
}
diff --git a/main/launcher/src/main/java/org/cryptomator/logging/LaunchBasedTriggeringPolicy.java b/main/launcher/src/main/java/org/cryptomator/logging/LaunchBasedTriggeringPolicy.java
new file mode 100644
index 000000000..a04feebd7
--- /dev/null
+++ b/main/launcher/src/main/java/org/cryptomator/logging/LaunchBasedTriggeringPolicy.java
@@ -0,0 +1,20 @@
+package org.cryptomator.logging;
+
+import java.io.File;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import ch.qos.logback.core.rolling.TriggeringPolicyBase;
+
+/**
+ * Triggers a roll-over on the first log event, so each launched application instance will rotate the log.
+ */
+public class LaunchBasedTriggeringPolicy extends TriggeringPolicyBase {
+
+ private final AtomicBoolean shouldTrigger = new AtomicBoolean(true);
+
+ @Override
+ public boolean isTriggeringEvent(File activeFile, E event) {
+ return shouldTrigger.get() && shouldTrigger.getAndSet(false);
+ }
+
+}
diff --git a/main/launcher/src/main/resources/log4j2.xml b/main/launcher/src/main/resources/log4j2.xml
deleted file mode 100644
index 85afbab88..000000000
--- a/main/launcher/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main/launcher/src/test/java/org/cryptomator/logging/LaunchBasedTriggeringPolicyTest.java b/main/launcher/src/test/java/org/cryptomator/logging/LaunchBasedTriggeringPolicyTest.java
new file mode 100644
index 000000000..8dd3da4ce
--- /dev/null
+++ b/main/launcher/src/test/java/org/cryptomator/logging/LaunchBasedTriggeringPolicyTest.java
@@ -0,0 +1,33 @@
+package org.cryptomator.logging;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class LaunchBasedTriggeringPolicyTest {
+
+ @Test
+ public void testTriggerOnceAndNeverAgain() {
+ LaunchBasedTriggeringPolicy