Commit 7e6f6158 authored by Pape, David (FWCC) - 139658's avatar Pape, David (FWCC) - 139658 Committed by Pape, David (FWCC) - 139658
Browse files

Set reasonable default logging directory

parent 60f12e63
Pipeline #63455 failed with stages
in 61 minutes and 19 seconds
......@@ -36,10 +36,8 @@ Config::Config() {
}
auto &users = c.lookup(SETTING_CLUSTER_USERS);
// Need the (int) cast operator. No other possibility for this?
// ClusterUsers.insert(...) seems not to work.
for (auto usersIt = users.begin(); usersIt != users.end(); usersIt++) {
ClusterUsers.push_back((int)(*usersIt));
for (const auto &user : users) {
ClusterUsers.push_back(user);
}
try {
......
......@@ -33,8 +33,8 @@ private:
static constexpr auto SETTING_LOG_LEVEL = "log_level";
static constexpr auto SETTING_UNIFIED_OUTPUT = "unified_output";
static constexpr auto DEFAULT_DB_FILE = "hpc-driver.sqlite";
static constexpr auto DEFAULT_LOGGING_DIRECTORY = "logs";
static constexpr auto DEFAULT_DB_FILE = "/var/run/gitlab-hpc-driver.sqlite";
static constexpr auto DEFAULT_LOGGING_DIRECTORY = "/var/log/gitlab-hpc-driver";
static constexpr auto DEFAULT_LOG_LEVEL = "off";
static constexpr bool DEFAULT_UNIFIED_OUTPUT = true;
};
......
......@@ -39,7 +39,7 @@ Job *JobFactory::CreateCIJob(int jobID, const std::string &jobStage,
if (!ec) {
SPDLOG_ERROR("Provided script {} is not a regular file.", script.string());
} else {
SPDLOG_ERROR("Error when checking script: {}", ec.message());
SPDLOG_ERROR("Error when checking script {}: {}", script.string(), ec.message());
}
return nullptr;
}
......
......@@ -7,6 +7,7 @@
#include <memory>
#include <regex>
#include <sstream>
#include <thread>
#include <vector>
#include "driver/User.h"
......
......@@ -4,6 +4,7 @@
#include <array>
#include <filesystem>
#include <string>
#include <unistd.h>
#include "libconfig.h++"
......@@ -15,18 +16,14 @@ using namespace driver;
void logging::setup(const std::filesystem::path &loggingDirectory,
const spdlog::level::level_enum &logLevel) {
auto permissions = std::filesystem::perms::all &
~std::filesystem::perms::group_write &
~std::filesystem::perms::others_write;
std::filesystem::create_directory(loggingDirectory);
std::filesystem::permissions(loggingDirectory, permissions);
std::filesystem::permissions(loggingDirectory, std::filesystem::perms::owner_all);
pid_t pid = ::getpid();
spdlog::set_default_logger(spdlog::daily_logger_mt(
"GitLab HPC Driver (" + std::to_string(pid) + ")",
(loggingDirectory / "hpc-driver.log").string()));
(loggingDirectory / "gitlab-hpc-driver.log").string()));
spdlog::set_level(logLevel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment