src/server/daemon/config.c

changeset 77
f1cff81e425a
parent 75
6195c92262a2
child 79
f48cea237ec3
--- a/src/server/daemon/config.c	Mon Jun 24 14:41:32 2013 +0200
+++ b/src/server/daemon/config.c	Tue Jun 25 15:45:13 2013 +0200
@@ -434,12 +434,23 @@
         return 0;
     }
     sstr_t format;
-    format.ptr = NULL; 
+    format.ptr = NULL;
+    format.length = 0;
     
-    AccessLog *log = get_access_log(file, format);
-    if(log) {
-        // access logs are only stored in the server config to free them
-        cfg->logfiles = ucx_list_append(cfg->logfiles, log);
+    //AccessLog *log = get_access_log(file, format);
+    LogFile *log_file = get_access_log_file(file);
+    if(!log_file) {
+        // TODO: error/warning
+        return 0;
+    }
+    AccessLog *log = pool_malloc(cfg->pool, sizeof(AccessLog));
+    log->file = sstrdup_pool(cfg->pool, file);
+    log->format = format;
+    log->log = log_file;
+    cfg->logfiles = ucx_list_append(cfg->logfiles, log);
+    
+    if(!cfg->default_log) {
+        cfg->default_log = log;
     }
     
     return 0;
@@ -632,7 +643,7 @@
     
     // set the access log for the virtual server
     // TODO: don't use always the default
-    vs->log = get_default_access_log();
+    vs->log = cfg->default_log;
 
     ucx_map_sstr_put(cfg->host_vs, vs->host, vs);
     

mercurial