1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
--- openmosixview-1.5.orig/openmosixcollector/main.cpp
+++ openmosixview-1.5/openmosixcollector/main.cpp
@@ -19,6 +19,7 @@
#include <config.h>
#endif
+#include <syslog.h>
#include "openmosixcollector.h"
@@ -76,7 +77,7 @@
while (1) {
if(!collector->checknodes()) {
collector->updatenodelist();
- cout << "updating nodelist" << endl;
+ syslog(LOG_INFO, "updating nodelist");
}
collector->lognodes();
tsecs = collector->incrementcounter();
--- openmosixview-1.5.orig/openmosixcollector/openmosixcollector.cpp
+++ openmosixview-1.5/openmosixcollector/openmosixcollector.cpp
@@ -15,6 +15,8 @@
* *
***************************************************************************/
+#include <syslog.h>
+
#include "openmosixcollector.h"
openmosixcollector::openmosixcollector(){
@@ -204,6 +206,7 @@
}
exit(0);
}
+ openlog("openmosixcollector",LOG_PID,LOG_USER);
return 1;
}
}
@@ -418,7 +421,8 @@
nodelogfile << "\n";
nodelogfile.close();
} else {
- cout << "could not write to " << nodelogfile_txt << endl;
+ syslog(LOG_ERR, "could not write to %s",
+ nodelogfile_txt.c_str());
}
} else {
@@ -467,11 +471,11 @@
synclogfile << "\n";
synclogfile.close();
} else {
- cout << "could not write to " << nodelogfile_txt << endl;
+ syslog(LOG_ERR, "could not write to %s",
+ nodelogfile_txt.c_str());
}
} // end of for
- cout << "synced the file " << nodelogfile_txt << endl;
-
+ syslog(LOG_DEBUG, "synced the file %s", nodelogfile_txt.c_str());
}
// end of sync check
@@ -526,7 +530,8 @@
clusterlogfile << "\n";
clusterlogfile.close();
} else {
- cout << "could not write to " << clusterlogfile_txt << endl;
+ syslog(LOG_ERR, "could not write to %s",
+ clusterlogfile_txt.c_str());
}
}
@@ -554,7 +559,8 @@
return cread;
}
} else {
- cout << "could not read from " << clusterdirectory << what << tmpstr << endl;
+ syslog(LOG_ERR, "could not read from %s%s%s",
+ clusterdirectory, what.c_str(), tmpstr.c_str());
return "0";
}
}
@@ -696,7 +702,7 @@
processlogfile << "\n";
processlogfile.close();
} else {
- cout << "could not write to " << processlogfile_txt << endl;
+ syslog(LOG_ERR, "could not write to %s", processlogfile_txt.c_str());
}
}
}
@@ -840,7 +846,7 @@
writeval.close();
return countit;
} else {
- cout << "could not write to " << tmpstr << endl;
+ syslog(LOG_ERR, "could not write to %s", tmpstr.c_str());
return 0;
}
}
|