Log to file:
2009-03-01 04:02:22,2, smsd: Smsd v3.1.3 started.
2009-03-06 18:12:41,5, GSM1: SMS received, From: 00000000000
2009-03-06 18:12:41,5, GSM1: Wrote an incoming message file: /var/spool/sms/incoming/GSM1.dAif8Z
Log to syslog:
May 16 16:26:14 delta smsd: Smsd v3.1.3 started.
May 16 16:28:06 delta GSM1: GSM1: SMS received, From: 00000000000
May 16 16:28:06 delta GSM1: GSM1: Wrote an incoming message file: /var/spool/sms/incoming/GSM1.ZCRRFG
The patch below makes it log the way I expected it, like so:
May 16 17:20:24 delta smsd: Smsd v3.1.5beta9 started.
May 16 17:20:43 delta smsd: GSM1: SMS received, From: 00000000000
May 16 17:20:43 delta smsd: GSM1: Wrote an incoming message file: /var/spool/sms/incoming/GSM1.ZCRRFG
Regards,
Simon
diff -Naur smstools3.orig/src/logging.c smstools3/src/logging.c
--- smstools3.orig/src/logging.c 2009-05-05 18:29:48.000000000 +0200
+++ smstools3/src/logging.c 2009-05-16 17:15:03.000000000 +0200
@@ -28,12 +28,12 @@
int Filehandle = -1;
int Level;
-int openlogfile(char* filename,char* progname,int facility,int level)
+int openlogfile(char* filename,int facility,int level)
{
Level=level;
if (filename==0 || filename[0]==0 || strcmp(filename,"syslog")==0 || strcmp(filename,"0")==0)
{
- openlog(progname,LOG_CONS,facility);
+ openlog("smsd",LOG_CONS,facility);
Filehandle=-1;
return 0;
}
diff -Naur smstools3.orig/src/logging.h smstools3/src/logging.h
--- smstools3.orig/src/logging.h 2009-05-05 18:30:34.000000000 +0200
+++ smstools3/src/logging.h 2009-05-16 17:15:20.000000000 +0200
@@ -16,7 +16,7 @@
#ifndef LOGGING_H
#define LOGGING_H
-int openlogfile(char* filename,char* progname,int facility,int level);
+int openlogfile(char* filename,int facility,int level);
// if filename if 0, "" or "syslog": opens syslog. Level is ignored.
// else: opens a log file. Facility is not used. Level specifies the verbosity (9=highest).
diff -Naur smstools3.orig/src/smsd.c smstools3/src/smsd.c
--- smstools3.orig/src/smsd.c 2009-05-11 18:25:07.000000000 +0200
+++ smstools3/src/smsd.c 2009-05-16 17:16:27.000000000 +0200
@@ -5616,7 +5616,7 @@
exit(EXIT_FAILURE);
}
- logfilehandle = openlogfile(logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(logfile, LOG_DAEMON, loglevel);
writelogfile(LOG_CRIT, "Smsd v%s started.", smsd_version);
pwd = getpwuid(getuid());
@@ -5769,7 +5769,7 @@
{
if (devices[process_id].loglevel != -1)
loglevel = devices[process_id].loglevel;
- logfilehandle = openlogfile(devices[process_id].logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(devices[process_id].logfile, LOG_DAEMON, loglevel);
}
if (talk_with_modem(process_id) == 0)
@@ -5885,7 +5885,7 @@
{
if (devices[process_id].loglevel != -1)
loglevel = devices[process_id].loglevel;
- logfilehandle = openlogfile(devices[process_id].logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(devices[process_id].logfile, LOG_DAEMON, loglevel);
}
devicespooler(process_id, &modem);
--- smstools3.orig/src/logging.c 2009-05-05 18:29:48.000000000 +0200
+++ smstools3/src/logging.c 2009-05-16 17:15:03.000000000 +0200
@@ -28,12 +28,12 @@
int Filehandle = -1;
int Level;
-int openlogfile(char* filename,char* progname,int facility,int level)
+int openlogfile(char* filename,int facility,int level)
{
Level=level;
if (filename==0 || filename[0]==0 || strcmp(filename,"syslog")==0 || strcmp(filename,"0")==0)
{
- openlog(progname,LOG_CONS,facility);
+ openlog("smsd",LOG_CONS,facility);
Filehandle=-1;
return 0;
}
diff -Naur smstools3.orig/src/logging.h smstools3/src/logging.h
--- smstools3.orig/src/logging.h 2009-05-05 18:30:34.000000000 +0200
+++ smstools3/src/logging.h 2009-05-16 17:15:20.000000000 +0200
@@ -16,7 +16,7 @@
#ifndef LOGGING_H
#define LOGGING_H
-int openlogfile(char* filename,char* progname,int facility,int level);
+int openlogfile(char* filename,int facility,int level);
// if filename if 0, "" or "syslog": opens syslog. Level is ignored.
// else: opens a log file. Facility is not used. Level specifies the verbosity (9=highest).
diff -Naur smstools3.orig/src/smsd.c smstools3/src/smsd.c
--- smstools3.orig/src/smsd.c 2009-05-11 18:25:07.000000000 +0200
+++ smstools3/src/smsd.c 2009-05-16 17:16:27.000000000 +0200
@@ -5616,7 +5616,7 @@
exit(EXIT_FAILURE);
}
- logfilehandle = openlogfile(logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(logfile, LOG_DAEMON, loglevel);
writelogfile(LOG_CRIT, "Smsd v%s started.", smsd_version);
pwd = getpwuid(getuid());
@@ -5769,7 +5769,7 @@
{
if (devices[process_id].loglevel != -1)
loglevel = devices[process_id].loglevel;
- logfilehandle = openlogfile(devices[process_id].logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(devices[process_id].logfile, LOG_DAEMON, loglevel);
}
if (talk_with_modem(process_id) == 0)
@@ -5885,7 +5885,7 @@
{
if (devices[process_id].loglevel != -1)
loglevel = devices[process_id].loglevel;
- logfilehandle = openlogfile(devices[process_id].logfile, process_title, LOG_DAEMON, loglevel);
+ logfilehandle = openlogfile(devices[process_id].logfile, LOG_DAEMON, loglevel);
}
devicespooler(process_id, &modem);