From 81170f53eee443fbae18f3fe7960e3463f4efa18 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 1 Nov 2020 12:28:12 +0000 Subject: [PATCH] Add optional diabling of file rotation and UDP socket bug fixing. --- DGIdGateway/Conf.cpp | 8 +++++++ DGIdGateway/Conf.h | 2 ++ DGIdGateway/DGIdGateway.cpp | 4 ++-- DGIdGateway/DGIdGateway.ini | 1 + DGIdGateway/Log.cpp | 43 +++++++++++++++++++++++++++++++++-- DGIdGateway/Log.h | 4 ++-- DGIdGateway/UDPSocket.cpp | 6 +++++ DGIdGateway/Version.h | 2 +- YSFGateway/Conf.cpp | 8 +++++++ YSFGateway/Conf.h | 2 ++ YSFGateway/Log.cpp | 43 +++++++++++++++++++++++++++++++++-- YSFGateway/Log.h | 4 ++-- YSFGateway/UDPSocket.cpp | 6 +++++ YSFGateway/Version.h | 2 +- YSFGateway/YSFGateway.cpp | 4 ++-- YSFGateway/YSFGateway.ini | 1 + YSFParrot/UDPSocket.cpp | 6 +++++ YSFParrot/Version.h | 2 +- YSFReflector/Conf.cpp | 8 +++++++ YSFReflector/Conf.h | 2 ++ YSFReflector/Log.cpp | 43 +++++++++++++++++++++++++++++++++-- YSFReflector/Log.h | 4 ++-- YSFReflector/UDPSocket.cpp | 6 +++++ YSFReflector/Version.h | 2 +- YSFReflector/YSFReflector.cpp | 4 ++-- YSFReflector/YSFReflector.ini | 1 + 26 files changed, 196 insertions(+), 22 deletions(-) diff --git a/DGIdGateway/Conf.cpp b/DGIdGateway/Conf.cpp index 98d1341..6bc6ead 100644 --- a/DGIdGateway/Conf.cpp +++ b/DGIdGateway/Conf.cpp @@ -65,6 +65,7 @@ m_logDisplayLevel(0U), m_logFileLevel(0U), m_logFilePath(), m_logFileRoot(), +m_logFileRotate(true), m_aprsEnabled(false), m_aprsAddress(), m_aprsPort(0U), @@ -216,6 +217,8 @@ bool CConf::read() m_logFileLevel = (unsigned int)::atoi(value); else if (::strcmp(key, "DisplayLevel") == 0) m_logDisplayLevel = (unsigned int)::atoi(value); + else if (::strcmp(key, "FileRotate") == 0) + m_logFileRotate = ::atoi(value) == 1; } else if (section == SECTION_APRS) { if (::strcmp(key, "Enable") == 0) m_aprsEnabled = ::atoi(value) == 1; @@ -417,6 +420,11 @@ std::string CConf::getLogFileRoot() const return m_logFileRoot; } +bool CConf::getLogFileRotate() const +{ + return m_logFileRotate; +} + bool CConf::getAPRSEnabled() const { return m_aprsEnabled; diff --git a/DGIdGateway/Conf.h b/DGIdGateway/Conf.h index 44ebf88..804b636 100644 --- a/DGIdGateway/Conf.h +++ b/DGIdGateway/Conf.h @@ -76,6 +76,7 @@ public: unsigned int getLogFileLevel() const; std::string getLogFilePath() const; std::string getLogFileRoot() const; + bool getLogFileRotate() const; // The APRS section bool getAPRSEnabled() const; @@ -122,6 +123,7 @@ private: unsigned int m_logFileLevel; std::string m_logFilePath; std::string m_logFileRoot; + bool m_logFileRotate; bool m_aprsEnabled; std::string m_aprsAddress; diff --git a/DGIdGateway/DGIdGateway.cpp b/DGIdGateway/DGIdGateway.cpp index aafd75e..1175488 100644 --- a/DGIdGateway/DGIdGateway.cpp +++ b/DGIdGateway/DGIdGateway.cpp @@ -169,9 +169,9 @@ int CDGIdGateway::run() #endif #if !defined(_WIN32) && !defined(_WIN64) - ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #else - ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #endif if (!ret) { ::fprintf(stderr, "DGIdGateway: unable to open the log file\n"); diff --git a/DGIdGateway/DGIdGateway.ini b/DGIdGateway/DGIdGateway.ini index f5a97eb..0c50100 100644 --- a/DGIdGateway/DGIdGateway.ini +++ b/DGIdGateway/DGIdGateway.ini @@ -28,6 +28,7 @@ DisplayLevel=1 FileLevel=1 FilePath=. FileRoot=DGIdGateway +FileRotate=1 [APRS] Enable=0 diff --git a/DGIdGateway/Log.cpp b/DGIdGateway/Log.cpp index 1d5ad29..5d80ca4 100644 --- a/DGIdGateway/Log.cpp +++ b/DGIdGateway/Log.cpp @@ -35,6 +35,7 @@ static unsigned int m_fileLevel = 2U; static std::string m_filePath; static std::string m_fileRoot; +static bool m_fileRotate = true; static FILE* m_fpLog = NULL; static bool m_daemon = false; @@ -45,7 +46,7 @@ static struct tm m_tm; static char LEVELS[] = " DMIWEF"; -static bool LogOpen() +static bool logOpenRotate() { bool status = false; @@ -86,13 +87,51 @@ static bool LogOpen() return status; } -bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel) +static bool logOpenNoRotate() +{ + bool status = false; + + if (m_fileLevel == 0U) + return true; + + if (m_fpLog != NULL) + return true; + + char filename[200U]; +#if defined(_WIN32) || defined(_WIN64) + ::sprintf(filename, "%s\\%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#else + ::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#endif + + if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) { + status = true; + +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) + dup2(fileno(m_fpLog), fileno(stderr)); +#endif + } + + return status; +} + +bool LogOpen() +{ + if (m_fileRotate) + return logOpenRotate(); + else + return logOpenNoRotate(); +} + +bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate) { m_filePath = filePath; m_fileRoot = fileRoot; m_fileLevel = fileLevel; m_displayLevel = displayLevel; m_daemon = daemon; + m_fileRotate = rotate; if (m_daemon) m_displayLevel = 0U; diff --git a/DGIdGateway/Log.h b/DGIdGateway/Log.h index 0d00653..ae95b60 100644 --- a/DGIdGateway/Log.h +++ b/DGIdGateway/Log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ extern void Log(unsigned int level, const char* fmt, ...); -extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel); +extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate); extern void LogFinalise(); #endif diff --git a/DGIdGateway/UDPSocket.cpp b/DGIdGateway/UDPSocket.cpp index 3f6192a..510c8a2 100644 --- a/DGIdGateway/UDPSocket.cpp +++ b/DGIdGateway/UDPSocket.cpp @@ -289,6 +289,12 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag LogError("Error returned from recvfrom, err: %lu", ::GetLastError()); #else LogError("Error returned from recvfrom, err: %d", errno); + + if (len == -1 && errno == ENOTSOCK) { + LogMessage("Re-opening UDP port on %u", m_port); + close(); + open(); + } #endif return -1; } diff --git a/DGIdGateway/Version.h b/DGIdGateway/Version.h index fa16a60..8d5b383 100644 --- a/DGIdGateway/Version.h +++ b/DGIdGateway/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20201029"; +const char* VERSION = "20201101"; #endif diff --git a/YSFGateway/Conf.cpp b/YSFGateway/Conf.cpp index 2efaf7e..89a5deb 100644 --- a/YSFGateway/Conf.cpp +++ b/YSFGateway/Conf.cpp @@ -64,6 +64,7 @@ m_logDisplayLevel(0U), m_logFileLevel(0U), m_logFilePath(), m_logFileRoot(), +m_logFileRotate(true), m_aprsEnabled(false), m_aprsAddress(), m_aprsPort(0U), @@ -221,6 +222,8 @@ bool CConf::read() m_logFileLevel = (unsigned int)::atoi(value); else if (::strcmp(key, "DisplayLevel") == 0) m_logDisplayLevel = (unsigned int)::atoi(value); + else if (::strcmp(key, "FileRotate") == 0) + m_logFileRotate = ::atoi(value) == 1; } else if (section == SECTION_APRS) { if (::strcmp(key, "Enable") == 0) m_aprsEnabled = ::atoi(value) == 1; @@ -410,6 +413,11 @@ std::string CConf::getLogFileRoot() const return m_logFileRoot; } +bool CConf::getLogFileRotate() const +{ + return m_logFileRotate; +} + bool CConf::getAPRSEnabled() const { return m_aprsEnabled; diff --git a/YSFGateway/Conf.h b/YSFGateway/Conf.h index e050599..4a32592 100644 --- a/YSFGateway/Conf.h +++ b/YSFGateway/Conf.h @@ -57,6 +57,7 @@ public: unsigned int getLogFileLevel() const; std::string getLogFilePath() const; std::string getLogFileRoot() const; + bool getLogFileRotate() const; // The APRS section bool getAPRSEnabled() const; @@ -127,6 +128,7 @@ private: unsigned int m_logFileLevel; std::string m_logFilePath; std::string m_logFileRoot; + bool m_logFileRotate; bool m_aprsEnabled; std::string m_aprsAddress; diff --git a/YSFGateway/Log.cpp b/YSFGateway/Log.cpp index 1d5ad29..5d80ca4 100644 --- a/YSFGateway/Log.cpp +++ b/YSFGateway/Log.cpp @@ -35,6 +35,7 @@ static unsigned int m_fileLevel = 2U; static std::string m_filePath; static std::string m_fileRoot; +static bool m_fileRotate = true; static FILE* m_fpLog = NULL; static bool m_daemon = false; @@ -45,7 +46,7 @@ static struct tm m_tm; static char LEVELS[] = " DMIWEF"; -static bool LogOpen() +static bool logOpenRotate() { bool status = false; @@ -86,13 +87,51 @@ static bool LogOpen() return status; } -bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel) +static bool logOpenNoRotate() +{ + bool status = false; + + if (m_fileLevel == 0U) + return true; + + if (m_fpLog != NULL) + return true; + + char filename[200U]; +#if defined(_WIN32) || defined(_WIN64) + ::sprintf(filename, "%s\\%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#else + ::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#endif + + if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) { + status = true; + +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) + dup2(fileno(m_fpLog), fileno(stderr)); +#endif + } + + return status; +} + +bool LogOpen() +{ + if (m_fileRotate) + return logOpenRotate(); + else + return logOpenNoRotate(); +} + +bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate) { m_filePath = filePath; m_fileRoot = fileRoot; m_fileLevel = fileLevel; m_displayLevel = displayLevel; m_daemon = daemon; + m_fileRotate = rotate; if (m_daemon) m_displayLevel = 0U; diff --git a/YSFGateway/Log.h b/YSFGateway/Log.h index 0d00653..ae95b60 100644 --- a/YSFGateway/Log.h +++ b/YSFGateway/Log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ extern void Log(unsigned int level, const char* fmt, ...); -extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel); +extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate); extern void LogFinalise(); #endif diff --git a/YSFGateway/UDPSocket.cpp b/YSFGateway/UDPSocket.cpp index 3f6192a..510c8a2 100644 --- a/YSFGateway/UDPSocket.cpp +++ b/YSFGateway/UDPSocket.cpp @@ -289,6 +289,12 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag LogError("Error returned from recvfrom, err: %lu", ::GetLastError()); #else LogError("Error returned from recvfrom, err: %d", errno); + + if (len == -1 && errno == ENOTSOCK) { + LogMessage("Re-opening UDP port on %u", m_port); + close(); + open(); + } #endif return -1; } diff --git a/YSFGateway/Version.h b/YSFGateway/Version.h index 8bc1fe8..8d5b383 100644 --- a/YSFGateway/Version.h +++ b/YSFGateway/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200921"; +const char* VERSION = "20201101"; #endif diff --git a/YSFGateway/YSFGateway.cpp b/YSFGateway/YSFGateway.cpp index 94bf49e..45c7725 100644 --- a/YSFGateway/YSFGateway.cpp +++ b/YSFGateway/YSFGateway.cpp @@ -171,9 +171,9 @@ int CYSFGateway::run() #endif #if !defined(_WIN32) && !defined(_WIN64) - ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #else - ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #endif if (!ret) { ::fprintf(stderr, "YSFGateway: unable to open the log file\n"); diff --git a/YSFGateway/YSFGateway.ini b/YSFGateway/YSFGateway.ini index c3376c8..cc9f53e 100644 --- a/YSFGateway/YSFGateway.ini +++ b/YSFGateway/YSFGateway.ini @@ -28,6 +28,7 @@ DisplayLevel=1 FileLevel=1 FilePath=. FileRoot=YSFGateway +FileRotate=1 [APRS] Enable=0 diff --git a/YSFParrot/UDPSocket.cpp b/YSFParrot/UDPSocket.cpp index 3f6192a..510c8a2 100644 --- a/YSFParrot/UDPSocket.cpp +++ b/YSFParrot/UDPSocket.cpp @@ -289,6 +289,12 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag LogError("Error returned from recvfrom, err: %lu", ::GetLastError()); #else LogError("Error returned from recvfrom, err: %d", errno); + + if (len == -1 && errno == ENOTSOCK) { + LogMessage("Re-opening UDP port on %u", m_port); + close(); + open(); + } #endif return -1; } diff --git a/YSFParrot/Version.h b/YSFParrot/Version.h index a718af3..e9186a6 100644 --- a/YSFParrot/Version.h +++ b/YSFParrot/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200920"; +const char* VERSION = "20201101"; #endif diff --git a/YSFReflector/Conf.cpp b/YSFReflector/Conf.cpp index 277fed1..9c6bd2f 100644 --- a/YSFReflector/Conf.cpp +++ b/YSFReflector/Conf.cpp @@ -44,6 +44,7 @@ m_logDisplayLevel(0U), m_logFileLevel(0U), m_logFilePath(), m_logFileRoot(), +m_logFileRotate(true), m_networkPort(0U), m_networkDebug(false) { @@ -127,6 +128,8 @@ bool CConf::read() m_logFileLevel = (unsigned int)::atoi(value); else if (::strcmp(key, "DisplayLevel") == 0) m_logDisplayLevel = (unsigned int)::atoi(value); + else if (::strcmp(key, "FileRotate") == 0) + m_logFileRotate = ::atoi(value) == 1; } else if (section == SECTION_NETWORK) { if (::strcmp(key, "Port") == 0) m_networkPort = (unsigned int)::atoi(value); @@ -180,6 +183,11 @@ std::string CConf::getLogFileRoot() const return m_logFileRoot; } +bool CConf::getLogFileRotate() const +{ + return m_logFileRotate; +} + unsigned int CConf::getNetworkPort() const { return m_networkPort; diff --git a/YSFReflector/Conf.h b/YSFReflector/Conf.h index b3b7faa..f9e1732 100644 --- a/YSFReflector/Conf.h +++ b/YSFReflector/Conf.h @@ -43,6 +43,7 @@ public: unsigned int getLogFileLevel() const; std::string getLogFilePath() const; std::string getLogFileRoot() const; + bool getLogFileRotate() const; // The Network section unsigned int getNetworkPort() const; @@ -60,6 +61,7 @@ private: unsigned int m_logFileLevel; std::string m_logFilePath; std::string m_logFileRoot; + bool m_logFileRotate; unsigned int m_networkPort; bool m_networkDebug; diff --git a/YSFReflector/Log.cpp b/YSFReflector/Log.cpp index 1d5ad29..5d80ca4 100644 --- a/YSFReflector/Log.cpp +++ b/YSFReflector/Log.cpp @@ -35,6 +35,7 @@ static unsigned int m_fileLevel = 2U; static std::string m_filePath; static std::string m_fileRoot; +static bool m_fileRotate = true; static FILE* m_fpLog = NULL; static bool m_daemon = false; @@ -45,7 +46,7 @@ static struct tm m_tm; static char LEVELS[] = " DMIWEF"; -static bool LogOpen() +static bool logOpenRotate() { bool status = false; @@ -86,13 +87,51 @@ static bool LogOpen() return status; } -bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel) +static bool logOpenNoRotate() +{ + bool status = false; + + if (m_fileLevel == 0U) + return true; + + if (m_fpLog != NULL) + return true; + + char filename[200U]; +#if defined(_WIN32) || defined(_WIN64) + ::sprintf(filename, "%s\\%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#else + ::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str()); +#endif + + if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) { + status = true; + +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) + dup2(fileno(m_fpLog), fileno(stderr)); +#endif + } + + return status; +} + +bool LogOpen() +{ + if (m_fileRotate) + return logOpenRotate(); + else + return logOpenNoRotate(); +} + +bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate) { m_filePath = filePath; m_fileRoot = fileRoot; m_fileLevel = fileLevel; m_displayLevel = displayLevel; m_daemon = daemon; + m_fileRotate = rotate; if (m_daemon) m_displayLevel = 0U; diff --git a/YSFReflector/Log.h b/YSFReflector/Log.h index 0d00653..ae95b60 100644 --- a/YSFReflector/Log.h +++ b/YSFReflector/Log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ extern void Log(unsigned int level, const char* fmt, ...); -extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel); +extern bool LogInitialise(bool daemon, const std::string& filePath, const std::string& fileRoot, unsigned int fileLevel, unsigned int displayLevel, bool rotate); extern void LogFinalise(); #endif diff --git a/YSFReflector/UDPSocket.cpp b/YSFReflector/UDPSocket.cpp index 3f6192a..510c8a2 100644 --- a/YSFReflector/UDPSocket.cpp +++ b/YSFReflector/UDPSocket.cpp @@ -289,6 +289,12 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag LogError("Error returned from recvfrom, err: %lu", ::GetLastError()); #else LogError("Error returned from recvfrom, err: %d", errno); + + if (len == -1 && errno == ENOTSOCK) { + LogMessage("Re-opening UDP port on %u", m_port); + close(); + open(); + } #endif return -1; } diff --git a/YSFReflector/Version.h b/YSFReflector/Version.h index a718af3..e9186a6 100644 --- a/YSFReflector/Version.h +++ b/YSFReflector/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200920"; +const char* VERSION = "20201101"; #endif diff --git a/YSFReflector/YSFReflector.cpp b/YSFReflector/YSFReflector.cpp index 8270f8c..36a10de 100644 --- a/YSFReflector/YSFReflector.cpp +++ b/YSFReflector/YSFReflector.cpp @@ -151,9 +151,9 @@ void CYSFReflector::run() #endif #if !defined(_WIN32) && !defined(_WIN64) - ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(m_daemon, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #else - ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel()); + ret = ::LogInitialise(false, m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), m_conf.getLogDisplayLevel(), m_conf.getLogFileRotate()); #endif if (!ret) { ::fprintf(stderr, "YSFReflector: unable to open the log file\n"); diff --git a/YSFReflector/YSFReflector.ini b/YSFReflector/YSFReflector.ini index e4e6990..35f1be7 100644 --- a/YSFReflector/YSFReflector.ini +++ b/YSFReflector/YSFReflector.ini @@ -14,6 +14,7 @@ DisplayLevel=1 FileLevel=1 FilePath=. FileRoot=YSFReflector +FileRotate=1 [Network] Port=42000