Merge 0.9->trunk
[prosody.git] / plugins / mod_posix.lua
index db594ccc753ca0c2acd306ff54b2bd7a048a0d0c..e871e5cf4d8c9ab825f6b13b0eb8d1a5a95fe95a 100644 (file)
@@ -136,8 +136,17 @@ if daemonize == nil then
        end
 end
 
+local function remove_log_sinks()
+       local lm = require "core.loggingmanager";
+       lm.register_sink_type("console", nil);
+       lm.register_sink_type("stdout", nil);
+       lm.reload_logging();
+end
+
 if daemonize then
        local function daemonize_server()
+               module:log("info", "Prosody is about to detach from the console, disabling further console output");
+               remove_log_sinks();
                local ok, ret = pposix.daemonize();
                if not ok then
                        module:log("error", "Failed to daemonize: %s", ret);