SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Wed Nov 20, 2019 19:12
SMSTools3 Community » Bug reports Bottom

[included in 3.1.5] PATCH: fix smstools logging progname to syslog

  This topic is locked

Page:  1

Author Post
Member
Registered:
May 2009
When logging to syslog, smstools is missing the correct program name in certain situations while logging to a file looks fine.

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);
 
'diff' Syntax Highlight powered by GeSHi


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thank's, this fix will be included in the next release.

Perhaps the format in syslog could be:
May 16 17:20:24 delta smsd: MAINPROCESS: Smsd v3.1.5beta9 started.
May 16 17:20:43 delta smsd: GSM1: SMS received, From: 00000000000

It might be easier to parse and is similar than a process list if using the latest sms3 script:


What do you think?

Member
Registered:
May 2009
Topic owner
Sounds like a good idea. May I suggest to call it MASTER instead of MAINPROCESS because it's a well known name for a main daemon process with many projects.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
This change is in 3.1.5 which is released today.

I have choosen MAINPROCESS term because it's already in use within smsd and some external gadgets too.

  This topic is locked

Page:  1

SMSTools3 Community » Bug reports Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.