2022-12-16 Fred Gleason <fredg@paravelsystems.com>

* Added a 'LogSqlQueries=' directive to the '[Debugging]'
	section of rd.conf(5).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-12-16 11:39:03 -05:00
parent ed968656c6
commit f1d2c02862
5 changed files with 36 additions and 1 deletions

View File

@ -23818,3 +23818,6 @@
2022-12-14 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdlogedit(1) that broke the 'Estimated' start
time mode.
2022-12-16 Fred Gleason <fredg@paravelsystems.com>
* Added a 'LogSqlQueries=' directive to the '[Debugging]'
section of rd.conf(5).

View File

@ -226,3 +226,10 @@ LogSearchStrings=
; priority levels. An empty argument disables logging.
; LogLogRefresh=LOG_DEBUG
LogLogRefresh=
; Send all SQL queries (including 'select' queries) to the syslog at the
; specified priority level.
; See the 'level' parameter in the syslog(3) man page for the set of available
; priority levels. An empty argument disables logging.
; LogSqlQueries=LOG_DEBUG
LogSqlQueries=

View File

@ -423,6 +423,18 @@ int RDConfig::logLogRefreshLevel() const
}
bool RDConfig::logSqlQueries() const
{
return conf_log_sql_queries;
}
int RDConfig::logSqlQueriesLevel() const
{
return conf_log_sql_queries_level;
}
int RDConfig::meterBasePort() const
{
return conf_meter_base_port;
@ -655,6 +667,9 @@ bool RDConfig::load()
conf_log_log_refresh_level=
SyslogPriorityLevel(profile->stringValue("Debugging","LogLogRefresh",""),
&conf_log_log_refresh);
conf_log_sql_queries_level=
SyslogPriorityLevel(profile->stringValue("Debugging","LogSqlQueries",""),
&conf_log_sql_queries);
conf_meter_base_port=
profile->intValue("Hacks","MeterPortBaseNumber",RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT);
conf_meter_port_range=
@ -788,6 +803,8 @@ void RDConfig::clear()
conf_log_search_strings_level=LOG_DEBUG;
conf_log_log_refresh=false;
conf_log_log_refresh_level=LOG_DEBUG;
conf_log_sql_queries=false;
conf_log_sql_queries_level=LOG_DEBUG;
conf_lock_rdairplay_memory=false;
conf_meter_base_port=RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT;
conf_meter_port_range=RD_METER_SOCKET_PORT_RANGE;

View File

@ -109,6 +109,8 @@ class RDConfig
int logSearchStringsLevel() const;
bool logLogRefresh() const;
int logLogRefreshLevel() const;
bool logSqlQueries() const;
int logSqlQueriesLevel() const;
bool enableMixerLogging() const;
uid_t uid() const;
gid_t gid() const;
@ -186,6 +188,8 @@ class RDConfig
int conf_log_search_strings_level;
bool conf_log_log_refresh;
int conf_log_log_refresh_level;
bool conf_log_sql_queries;
int conf_log_sql_queries_level;
bool conf_lock_rdairplay_memory;
QString conf_save_webget_files_directory;
bool conf_suppress_rdcatch_meter_updates;

View File

@ -65,6 +65,10 @@ RDSqlQuery::RDSqlQuery (const QString &query,bool reconnect):
}
if(isActive()) {
if((rda!=NULL)&&(rda->config()->logSqlQueries())) {
rda->syslog(rda->config()->logSqlQueriesLevel(),
"SQL: %s",query.toUtf8().constData());
}
//printf("QUERY: %s\n",(const char *)query.toUtf8());
QStringList f0=query.split(" ");
if(f0[0].toLower()=="select") {