summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/log.c7
-rw-r--r--src/core/log.h2
-rw-r--r--src/fe-common/core/fe-log.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/core/log.c b/src/core/log.c
index 743121f7..f3cb1153 100644
--- a/src/core/log.c
+++ b/src/core/log.c
@@ -165,7 +165,7 @@ void log_stop_logging(LOG_REC *log)
static void log_rotate_check(LOG_REC *log)
{
- char *new_fname;
+ char *new_fname, *dir;
g_return_if_fail(log != NULL);
@@ -177,6 +177,11 @@ static void log_rotate_check(LOG_REC *log)
/* rotate log */
log_stop_logging(log);
signal_emit("log rotated", 1, log);
+
+ dir = g_dirname(new_fname);
+ mkpath(dir, LOG_DIR_CREATE_MODE);
+ g_free(dir);
+
log_start_logging(log);
}
g_free(new_fname);
diff --git a/src/core/log.h b/src/core/log.h
index 0bca0820..8631c7a5 100644
--- a/src/core/log.h
+++ b/src/core/log.h
@@ -1,6 +1,8 @@
#ifndef __LOG_H
#define __LOG_H
+#define LOG_DIR_CREATE_MODE 0770
+
enum {
LOG_ITEM_TARGET, /* channel, query, .. */
LOG_ITEM_WINDOW_REFNUM
diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c
index dad36684..a0be229b 100644
--- a/src/fe-common/core/fe-log.c
+++ b/src/fe-common/core/fe-log.c
@@ -40,8 +40,6 @@
/* close autologs after 5 minutes of inactivity */
#define AUTOLOG_INACTIVITY_CLOSE (60*5)
-#define LOG_DIR_CREATE_MODE 0770
-
static int autolog_level;
static int autoremove_tag;
static const char *autolog_path;