1 | diff --git a/mythtv/libs/libmyth/mythcommandlineparser.cpp b/mythtv/libs/libmyth/mythcommandlineparser.cpp
|
---|
2 | index c57dca7..2b42d35 100644
|
---|
3 | --- a/mythtv/libs/libmyth/mythcommandlineparser.cpp
|
---|
4 | +++ b/mythtv/libs/libmyth/mythcommandlineparser.cpp
|
---|
5 | @@ -1610,6 +1610,6 @@ int MythCommandLineParser::GetSyslogFacility(void)
|
---|
6 | if (setting == "none")
|
---|
7 | return 0;
|
---|
8 |
|
---|
9 | - return syslogGetFacility(setting);
|
---|
10 | + return 0;
|
---|
11 | }
|
---|
12 |
|
---|
13 | diff --git a/mythtv/libs/libmythbase/mythlogging.cpp b/mythtv/libs/libmythbase/mythlogging.cpp
|
---|
14 | index 962bc85..bc66ebc 100644
|
---|
15 | --- a/mythtv/libs/libmythbase/mythlogging.cpp
|
---|
16 | +++ b/mythtv/libs/libmythbase/mythlogging.cpp
|
---|
17 | @@ -16,7 +16,6 @@
|
---|
18 |
|
---|
19 | #include <stdlib.h>
|
---|
20 | #define SYSLOG_NAMES
|
---|
21 | -#include <syslog.h>
|
---|
22 | #include <stdarg.h>
|
---|
23 | #include <string.h>
|
---|
24 | #include <sys/stat.h>
|
---|
25 | @@ -66,7 +65,6 @@ char *getThreadName( LoggingItem_t *item );
|
---|
26 | int64_t getThreadTid( LoggingItem_t *item );
|
---|
27 | void setThreadTid( LoggingItem_t *item );
|
---|
28 | void deleteItem( LoggingItem_t *item );
|
---|
29 | -void logSighup( int signum, siginfo_t *info, void *secret );
|
---|
30 |
|
---|
31 | LoggerBase::LoggerBase(char *string, int number)
|
---|
32 | {
|
---|
33 | @@ -215,48 +213,6 @@ bool FileLogger::logmsg(LoggingItem_t *item)
|
---|
34 | return true;
|
---|
35 | }
|
---|
36 |
|
---|
37 | -
|
---|
38 | -SyslogLogger::SyslogLogger(int facility) : LoggerBase(NULL, facility),
|
---|
39 | - m_opened(false)
|
---|
40 | -{
|
---|
41 | - CODE *name;
|
---|
42 | -
|
---|
43 | - m_application = strdup((char *)QCoreApplication::applicationName()
|
---|
44 | - .toLocal8Bit().constData());
|
---|
45 | -
|
---|
46 | - openlog( m_application, LOG_NDELAY | LOG_PID, facility );
|
---|
47 | - m_opened = true;
|
---|
48 | -
|
---|
49 | - for( name = &facilitynames[0];
|
---|
50 | - name->c_name && name->c_val != facility; name++ );
|
---|
51 | -
|
---|
52 | - LogPrint(VB_IMPORTANT, LOG_INFO, "Added syslogging to facility %s",
|
---|
53 | - name->c_name);
|
---|
54 | -}
|
---|
55 | -
|
---|
56 | -SyslogLogger::~SyslogLogger()
|
---|
57 | -{
|
---|
58 | - LogPrint(VB_IMPORTANT, LOG_INFO, "Removing syslogging");
|
---|
59 | - free(m_application);
|
---|
60 | - closelog();
|
---|
61 | -}
|
---|
62 | -
|
---|
63 | -bool SyslogLogger::logmsg(LoggingItem_t *item)
|
---|
64 | -{
|
---|
65 | - if (!m_opened)
|
---|
66 | - return false;
|
---|
67 | -
|
---|
68 | - syslog( item->level, "%s", item->message );
|
---|
69 | -
|
---|
70 | - {
|
---|
71 | - QMutexLocker locker((QMutex *)item->refmutex);
|
---|
72 | - item->refcount--;
|
---|
73 | - }
|
---|
74 | -
|
---|
75 | - return true;
|
---|
76 | -}
|
---|
77 | -
|
---|
78 | -
|
---|
79 | DatabaseLogger::DatabaseLogger(char *table) : LoggerBase(table, 0),
|
---|
80 | m_host(NULL), m_opened(false),
|
---|
81 | m_loggingTableExists(false)
|
---|
82 | @@ -689,7 +645,7 @@ void LogPrintLine( uint32_t mask, LogLevel_t level, const char *file, int line,
|
---|
83 |
|
---|
84 | LogTimeStamp( &epoch, &usec );
|
---|
85 |
|
---|
86 | - localtime_r(&epoch, &item->tm);
|
---|
87 | + localtime(&epoch);
|
---|
88 | item->usec = usec;
|
---|
89 |
|
---|
90 | item->level = level;
|
---|
91 | @@ -704,25 +660,10 @@ void LogPrintLine( uint32_t mask, LogLevel_t level, const char *file, int line,
|
---|
92 | logQueue.enqueue(item);
|
---|
93 | }
|
---|
94 |
|
---|
95 | -void logSighup( int signum, siginfo_t *info, void *secret )
|
---|
96 | -{
|
---|
97 | - VERBOSE(VB_GENERAL, "SIGHUP received, rolling log files.");
|
---|
98 | -
|
---|
99 | - /* SIGHUP was sent. Close and reopen debug logfiles */
|
---|
100 | - QMutexLocker locker(&loggerListMutex);
|
---|
101 | -
|
---|
102 | - QList<LoggerBase *>::iterator it;
|
---|
103 | - for(it = loggerList.begin(); it != loggerList.end(); it++)
|
---|
104 | - {
|
---|
105 | - (*it)->reopen();
|
---|
106 | - }
|
---|
107 | -}
|
---|
108 | -
|
---|
109 |
|
---|
110 | void logStart(QString logfile, int quiet, int facility, bool dblog)
|
---|
111 | {
|
---|
112 | LoggerBase *logger;
|
---|
113 | - struct sigaction sa;
|
---|
114 |
|
---|
115 | if (logThread.isRunning())
|
---|
116 | return;
|
---|
117 | @@ -739,36 +680,19 @@ void logStart(QString logfile, int quiet, int facility, bool dblog)
|
---|
118 | if( facility < 0 )
|
---|
119 | LogPrint(VB_IMPORTANT, LOG_CRIT,
|
---|
120 | "Syslogging facility unknown, disabling syslog output");
|
---|
121 | - else if( facility > 0 )
|
---|
122 | - logger = new SyslogLogger(facility);
|
---|
123 |
|
---|
124 | /* Database */
|
---|
125 | if( dblog )
|
---|
126 | logger = new DatabaseLogger((char *)"logging");
|
---|
127 |
|
---|
128 | - /* Setup SIGHUP */
|
---|
129 | - LogPrint(VB_IMPORTANT, LOG_CRIT, "Setting up SIGHUP handler");
|
---|
130 | - sa.sa_sigaction = logSighup;
|
---|
131 | - sigemptyset( &sa.sa_mask );
|
---|
132 | - sa.sa_flags = SA_RESTART | SA_SIGINFO;
|
---|
133 | - sigaction( SIGHUP, &sa, NULL );
|
---|
134 | -
|
---|
135 | logThread.start();
|
---|
136 | }
|
---|
137 |
|
---|
138 | void logStop(void)
|
---|
139 | {
|
---|
140 | - struct sigaction sa;
|
---|
141 | -
|
---|
142 | logThread.stop();
|
---|
143 | logThread.wait();
|
---|
144 |
|
---|
145 | - /* Tear down SIGHUP */
|
---|
146 | - sa.sa_handler = SIG_DFL;
|
---|
147 | - sigemptyset( &sa.sa_mask );
|
---|
148 | - sa.sa_flags = SA_RESTART;
|
---|
149 | - sigaction( SIGHUP, &sa, NULL );
|
---|
150 | -
|
---|
151 | QMutexLocker locker(&loggerListMutex);
|
---|
152 | QList<LoggerBase *>::iterator it;
|
---|
153 |
|
---|
154 | @@ -798,7 +722,7 @@ void threadRegister(QString name)
|
---|
155 | memset( item, 0, sizeof(LoggingItem_t) );
|
---|
156 | LogTimeStamp( &epoch, &usec );
|
---|
157 |
|
---|
158 | - localtime_r(&epoch, &item->tm);
|
---|
159 | + localtime(&epoch);
|
---|
160 | item->usec = usec;
|
---|
161 |
|
---|
162 | item->level = (LogLevel_t)LOG_DEBUG;
|
---|
163 | @@ -831,7 +755,7 @@ void threadDeregister(void)
|
---|
164 | memset( item, 0, sizeof(LoggingItem_t) );
|
---|
165 | LogTimeStamp( &epoch, &usec );
|
---|
166 |
|
---|
167 | - localtime_r(&epoch, &item->tm);
|
---|
168 | + localtime(&epoch);
|
---|
169 | item->usec = usec;
|
---|
170 |
|
---|
171 | item->level = (LogLevel_t)LOG_DEBUG;
|
---|
172 | @@ -845,18 +769,6 @@ void threadDeregister(void)
|
---|
173 | logQueue.enqueue(item);
|
---|
174 | }
|
---|
175 |
|
---|
176 | -int syslogGetFacility(QString facility)
|
---|
177 | -{
|
---|
178 | - CODE *name;
|
---|
179 | - int i;
|
---|
180 | - char *string = (char *)facility.toLocal8Bit().constData();
|
---|
181 | -
|
---|
182 | - for( i = 0, name = &facilitynames[0];
|
---|
183 | - name->c_name && strcmp(name->c_name, string); i++, name++ );
|
---|
184 | -
|
---|
185 | - return( name->c_val );
|
---|
186 | -}
|
---|
187 | -
|
---|
188 | /*
|
---|
189 | * vim:ts=4:sw=4:ai:et:si:sts=4
|
---|
190 | */
|
---|
191 | diff --git a/mythtv/libs/libmythbase/mythlogging.h b/mythtv/libs/libmythbase/mythlogging.h
|
---|
192 | index 7ce95a9..ab67860 100644
|
---|
193 | --- a/mythtv/libs/libmythbase/mythlogging.h
|
---|
194 | +++ b/mythtv/libs/libmythbase/mythlogging.h
|
---|
195 | @@ -107,7 +107,6 @@ MBASE_PUBLIC void logStart(QString logfile, int quiet = 0, int facility = 0,
|
---|
196 | MBASE_PUBLIC void logStop(void);
|
---|
197 | MBASE_PUBLIC void threadRegister(QString name);
|
---|
198 | MBASE_PUBLIC void threadDeregister(void);
|
---|
199 | -MBASE_PUBLIC int syslogGetFacility(QString facility);
|
---|
200 |
|
---|
201 | void LogTimeStamp( time_t *epoch, uint32_t *usec );
|
---|
202 |
|
---|
203 | @@ -141,17 +140,6 @@ class FileLogger : public LoggerBase {
|
---|
204 | int m_fd;
|
---|
205 | };
|
---|
206 |
|
---|
207 | -class SyslogLogger : public LoggerBase {
|
---|
208 | - public:
|
---|
209 | - SyslogLogger(int facility);
|
---|
210 | - ~SyslogLogger();
|
---|
211 | - bool logmsg(LoggingItem_t *item);
|
---|
212 | - void reopen(void) { };
|
---|
213 | - private:
|
---|
214 | - char *m_application;
|
---|
215 | - bool m_opened;
|
---|
216 | -};
|
---|
217 | -
|
---|
218 | class DBLoggerThread;
|
---|
219 |
|
---|
220 | class DatabaseLogger : public LoggerBase {
|
---|