diff --git a/mythtv/libs/libmyth/mythcommandlineparser.cpp b/mythtv/libs/libmyth/mythcommandlineparser.cpp index c57dca7..2b42d35 100644 --- a/mythtv/libs/libmyth/mythcommandlineparser.cpp +++ b/mythtv/libs/libmyth/mythcommandlineparser.cpp @@ -1610,6 +1610,6 @@ int MythCommandLineParser::GetSyslogFacility(void) if (setting == "none") return 0; - return syslogGetFacility(setting); + return 0; } diff --git a/mythtv/libs/libmythbase/mythlogging.cpp b/mythtv/libs/libmythbase/mythlogging.cpp index 962bc85..bc66ebc 100644 --- a/mythtv/libs/libmythbase/mythlogging.cpp +++ b/mythtv/libs/libmythbase/mythlogging.cpp @@ -16,7 +16,6 @@ #include #define SYSLOG_NAMES -#include #include #include #include @@ -66,7 +65,6 @@ char *getThreadName( LoggingItem_t *item ); int64_t getThreadTid( LoggingItem_t *item ); void setThreadTid( LoggingItem_t *item ); void deleteItem( LoggingItem_t *item ); -void logSighup( int signum, siginfo_t *info, void *secret ); LoggerBase::LoggerBase(char *string, int number) { @@ -215,48 +213,6 @@ bool FileLogger::logmsg(LoggingItem_t *item) return true; } - -SyslogLogger::SyslogLogger(int facility) : LoggerBase(NULL, facility), - m_opened(false) -{ - CODE *name; - - m_application = strdup((char *)QCoreApplication::applicationName() - .toLocal8Bit().constData()); - - openlog( m_application, LOG_NDELAY | LOG_PID, facility ); - m_opened = true; - - for( name = &facilitynames[0]; - name->c_name && name->c_val != facility; name++ ); - - LogPrint(VB_IMPORTANT, LOG_INFO, "Added syslogging to facility %s", - name->c_name); -} - -SyslogLogger::~SyslogLogger() -{ - LogPrint(VB_IMPORTANT, LOG_INFO, "Removing syslogging"); - free(m_application); - closelog(); -} - -bool SyslogLogger::logmsg(LoggingItem_t *item) -{ - if (!m_opened) - return false; - - syslog( item->level, "%s", item->message ); - - { - QMutexLocker locker((QMutex *)item->refmutex); - item->refcount--; - } - - return true; -} - - DatabaseLogger::DatabaseLogger(char *table) : LoggerBase(table, 0), m_host(NULL), m_opened(false), m_loggingTableExists(false) @@ -689,7 +645,7 @@ void LogPrintLine( uint32_t mask, LogLevel_t level, const char *file, int line, LogTimeStamp( &epoch, &usec ); - localtime_r(&epoch, &item->tm); + localtime(&epoch); item->usec = usec; item->level = level; @@ -704,25 +660,10 @@ void LogPrintLine( uint32_t mask, LogLevel_t level, const char *file, int line, logQueue.enqueue(item); } -void logSighup( int signum, siginfo_t *info, void *secret ) -{ - VERBOSE(VB_GENERAL, "SIGHUP received, rolling log files."); - - /* SIGHUP was sent. Close and reopen debug logfiles */ - QMutexLocker locker(&loggerListMutex); - - QList::iterator it; - for(it = loggerList.begin(); it != loggerList.end(); it++) - { - (*it)->reopen(); - } -} - void logStart(QString logfile, int quiet, int facility, bool dblog) { LoggerBase *logger; - struct sigaction sa; if (logThread.isRunning()) return; @@ -739,36 +680,19 @@ void logStart(QString logfile, int quiet, int facility, bool dblog) if( facility < 0 ) LogPrint(VB_IMPORTANT, LOG_CRIT, "Syslogging facility unknown, disabling syslog output"); - else if( facility > 0 ) - logger = new SyslogLogger(facility); /* Database */ if( dblog ) logger = new DatabaseLogger((char *)"logging"); - /* Setup SIGHUP */ - LogPrint(VB_IMPORTANT, LOG_CRIT, "Setting up SIGHUP handler"); - sa.sa_sigaction = logSighup; - sigemptyset( &sa.sa_mask ); - sa.sa_flags = SA_RESTART | SA_SIGINFO; - sigaction( SIGHUP, &sa, NULL ); - logThread.start(); } void logStop(void) { - struct sigaction sa; - logThread.stop(); logThread.wait(); - /* Tear down SIGHUP */ - sa.sa_handler = SIG_DFL; - sigemptyset( &sa.sa_mask ); - sa.sa_flags = SA_RESTART; - sigaction( SIGHUP, &sa, NULL ); - QMutexLocker locker(&loggerListMutex); QList::iterator it; @@ -798,7 +722,7 @@ void threadRegister(QString name) memset( item, 0, sizeof(LoggingItem_t) ); LogTimeStamp( &epoch, &usec ); - localtime_r(&epoch, &item->tm); + localtime(&epoch); item->usec = usec; item->level = (LogLevel_t)LOG_DEBUG; @@ -831,7 +755,7 @@ void threadDeregister(void) memset( item, 0, sizeof(LoggingItem_t) ); LogTimeStamp( &epoch, &usec ); - localtime_r(&epoch, &item->tm); + localtime(&epoch); item->usec = usec; item->level = (LogLevel_t)LOG_DEBUG; @@ -845,18 +769,6 @@ void threadDeregister(void) logQueue.enqueue(item); } -int syslogGetFacility(QString facility) -{ - CODE *name; - int i; - char *string = (char *)facility.toLocal8Bit().constData(); - - for( i = 0, name = &facilitynames[0]; - name->c_name && strcmp(name->c_name, string); i++, name++ ); - - return( name->c_val ); -} - /* * vim:ts=4:sw=4:ai:et:si:sts=4 */ diff --git a/mythtv/libs/libmythbase/mythlogging.h b/mythtv/libs/libmythbase/mythlogging.h index 7ce95a9..ab67860 100644 --- a/mythtv/libs/libmythbase/mythlogging.h +++ b/mythtv/libs/libmythbase/mythlogging.h @@ -107,7 +107,6 @@ MBASE_PUBLIC void logStart(QString logfile, int quiet = 0, int facility = 0, MBASE_PUBLIC void logStop(void); MBASE_PUBLIC void threadRegister(QString name); MBASE_PUBLIC void threadDeregister(void); -MBASE_PUBLIC int syslogGetFacility(QString facility); void LogTimeStamp( time_t *epoch, uint32_t *usec ); @@ -141,17 +140,6 @@ class FileLogger : public LoggerBase { int m_fd; }; -class SyslogLogger : public LoggerBase { - public: - SyslogLogger(int facility); - ~SyslogLogger(); - bool logmsg(LoggingItem_t *item); - void reopen(void) { }; - private: - char *m_application; - bool m_opened; -}; - class DBLoggerThread; class DatabaseLogger : public LoggerBase {