From bb22b5cd2c7326a044ae8a4074531159ac700cef Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 Jan 2006 14:41:26 +0000 Subject: Made inspircd close and reopen its log on rehash git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2794 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd_io.h | 4 ++++ src/inspircd_io.cpp | 3 +++ src/userprocess.cpp | 15 +++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/inspircd_io.h b/include/inspircd_io.h index d89f41828..cf8e83906 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -274,6 +274,10 @@ class ServerConfig : public classbase */ char OperOnlyStats[MAXBUF]; + /** The path and filename of the ircd.log file + */ + std::string logpath; + ServerConfig(); /** Clears the include stack in preperation for diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index d685faf4e..0f4b56b55 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -29,6 +29,7 @@ using namespace std; #include "inspircd_io.h" #include "inspstring.h" #include "helperfuncs.h" +#include "userprocess.h" #include "xline.h" extern ServerConfig *Config; @@ -374,6 +375,8 @@ void Killed(int status) void Rehash(int status) { WriteOpers("Rehashing config file %s due to SIGHUP",CONFIG_FILE); + fclose(Config->log_file); + OpenLog(NULL,NULL); Config->Read(false,NULL); } diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 0d45c1f9c..5e8887701 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -56,6 +56,7 @@ using namespace std; #include "helperfuncs.h" #include "hashcomp.h" #include "socketengine.h" +#include "userprocess.h" #include "typedefs.h" #include "command_parse.h" #include "cull_list.h" @@ -347,18 +348,16 @@ bool DoBackgroundUserStuff(time_t TIME) void OpenLog(char** argv, int argc) { - std::string logpath = GetFullProgDir(argv,argc) + "/ircd.log"; - Config->log_file = fopen(logpath.c_str(),"a+"); + if (Config->logpath == "") + { + Config->logpath = GetFullProgDir(argv,argc) + "/ircd.log"; + } + Config->log_file = fopen(Config->logpath.c_str(),"a+"); if (!Config->log_file) { - printf("ERROR: Could not write to logfile %s, bailing!\n\n",logpath.c_str()); + printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str()); Exit(ERROR); } -#ifdef IS_CYGWIN - printf("Logging to ircd.log...\n"); -#else - printf("Logging to %s...\n",logpath.c_str()); -#endif } -- cgit v1.2.3