summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-14 23:23:51 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-14 23:23:51 +0200
commitd1e88e72910669d0ef71c114ffa889095ebafd66 (patch)
tree9f6bdce45c730b52ff1b5932b03bfee43243941c
parent1f3061fc0efdd9f137aac44a732920f2e08216f5 (diff)
parent091484a5e3d3e415210bf17ab3d151a9148e4905 (diff)
downloadmullvadvpn-d1e88e72910669d0ef71c114ffa889095ebafd66.tar.xz
mullvadvpn-d1e88e72910669d0ef71c114ffa889095ebafd66.zip
Merge branch 'consolidate-log-paths'
-rwxr-xr-xbuild.sh2
-rw-r--r--linux/mullvad-daemon.service2
-rw-r--r--mullvad-daemon/src/logging.rs10
-rw-r--r--mullvad-daemon/src/system_service.rs2
4 files changed, 12 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 40f1052be7..87116e49ee 100755
--- a/build.sh
+++ b/build.sh
@@ -32,7 +32,7 @@ esac
# Remove binaries. To make sure it is rebuilt with the stable toolchain and the latest changes.
cargo +stable clean
-echo "Compiling Rust backend in release mode with $RUSTC_VERSION..."
+echo "Compiling mullvad-daemon in release mode with $RUSTC_VERSION..."
cargo +stable build --release
diff --git a/linux/mullvad-daemon.service b/linux/mullvad-daemon.service
index 2fe6550f51..83c3032031 100644
--- a/linux/mullvad-daemon.service
+++ b/linux/mullvad-daemon.service
@@ -3,7 +3,7 @@ Description=Mullvad VPN daemon
Wants=network.target
[Service]
-ExecStart="/opt/Mullvad VPN/resources/mullvad-daemon" --disable-stdout-timestamps
+ExecStart="/opt/Mullvad VPN/resources/mullvad-daemon" -v --disable-stdout-timestamps --log /var/log/mullvad-daemon/daemon.log --tunnel-log /var/log/mullvad-daemon/openvpn.log
[Install]
WantedBy=multi-user.target
diff --git a/mullvad-daemon/src/logging.rs b/mullvad-daemon/src/logging.rs
index 4f4869d6e6..2ef62ad8cb 100644
--- a/mullvad-daemon/src/logging.rs
+++ b/mullvad-daemon/src/logging.rs
@@ -6,6 +6,7 @@ use chrono;
use log;
use std::fmt;
+use std::fs;
use std::io;
use std::path::PathBuf;
@@ -13,7 +14,11 @@ error_chain! {
errors {
WriteFileError(path: PathBuf) {
description("Unable to open log file for writing")
- display("Unable to open log file for writing: {}", path.to_string_lossy())
+ display("Unable to open log file for writing: {}", path.display())
+ }
+ CreateDirError(path: PathBuf) {
+ description("Unable to create directory for log")
+ display("Unable to create directory for log: {}", path.display())
}
}
foreign_links {
@@ -70,6 +75,9 @@ pub fn init_logger(
top_dispatcher = top_dispatcher.chain(stdout_dispatcher);
if let Some(ref log_file) = log_file {
+ if let Some(parent) = log_file.parent() {
+ fs::create_dir_all(parent).chain_err(|| ErrorKind::CreateDirError(parent.to_owned()))?;
+ }
let file_formatter = Formatter {
output_timestamp: true,
output_color: false,
diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs
index 28b8172203..2f3c22f85e 100644
--- a/mullvad-daemon/src/system_service.rs
+++ b/mullvad-daemon/src/system_service.rs
@@ -228,7 +228,7 @@ fn get_service_info() -> Result<ServiceInfo> {
::std::env::var_os("ALLUSERSPROFILE").ok_or_else(|| ErrorKind::NoLogDir)?;
let program_data_directory = Path::new(&program_data_directory_string);
let log_directory = program_data_directory.join(PRODUCT_NAME);
- let service_log_file = log_directory.join("backend.log");
+ let service_log_file = log_directory.join("daemon.log");
let tunnel_log_file = log_directory.join("openvpn.log");
if let Err(error) = fs::create_dir(log_directory) {