summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authordeva <deva>2010-07-05 09:14:46 +0000
committerdeva <deva>2010-07-05 09:14:46 +0000
commit59ff1aa927164b41a53cf78964b9bd6545bd7292 (patch)
treeafd9b9b7820767ed413a8a2a98ea7e0062f41795 /server
parentfbba835d7efaa4ee1d28bf5c7e2232e53d84af5e (diff)
Make pracro use new debug output interface (writes to a file).
Diffstat (limited to 'server')
-rw-r--r--server/TODO4
-rw-r--r--server/src/pracrod.cc24
2 files changed, 21 insertions, 7 deletions
diff --git a/server/TODO b/server/TODO
index 8603b4d..1c15b68 100644
--- a/server/TODO
+++ b/server/TODO
@@ -9,7 +9,3 @@ overvej generering af sessions id vha. cpr-nummer/template, hvorved cross
client sessioner muliggøres.
overvej problemer med samtidighed (to klienter arbejder på samme session
samtidig)
-
-# bug: rod med rækkefølgen af tidligere indtastede værdier kontra målinger
-# fra artefact
-# done \ No newline at end of file
diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc
index b8cbf13..e023bff 100644
--- a/server/src/pracrod.cc
+++ b/server/src/pracrod.cc
@@ -90,6 +90,7 @@ static const char usage_str[] =
" -D, --debug ddd Enable debug messages on 'ddd'; see documentation for details\n"
" -d --database db Use db as the database backend. Can be one of pgsql or testdb (default pgsql).\n"
" -s, --ssl keyfile Enable ssl encryption with the key stored in keyfile.\n"
+" -L, --logfile file Write output to file, instead of stderr.\n"
;
ConfigurationParser *configparser = NULL;
@@ -173,6 +174,7 @@ E0OPPYamkDI/+6Hx2KECQHF9xV1XatyXuFmfRAInK2BtfGY5UIvJaLxVD3Z1+i6q\n\
int main(int argc, char *argv[])
{
+ static FILE *logfp = stderr;
int c;
char *configfile = NULL;
char *user = NULL;
@@ -181,8 +183,7 @@ int main(int argc, char *argv[])
char *xml_basedir = NULL;
char *debugstr = NULL;
std::string database;
-
- debug_init(stderr);
+ std::string logfile;
int option_index = 0;
while(1) {
@@ -198,10 +199,12 @@ int main(int argc, char *argv[])
{"debug", required_argument, 0, 'D'},
{"database", required_argument, 0, 'd'},
{"ssl", required_argument, 0, 's'},
+ {"logfile", required_argument, 0, 'L'},
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:", long_options, &option_index);
+ c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:L:",
+ long_options, &option_index);
if (c == -1)
break;
@@ -231,6 +234,10 @@ int main(int argc, char *argv[])
xml_basedir = strdup(optarg);
break;
+ case 'L':
+ logfile = optarg;
+ break;
+
case 'D':
debugstr = strdup(optarg);
break;
@@ -262,6 +269,15 @@ int main(int argc, char *argv[])
}
}
+ if(logfile != "") {
+ logfp = fopen(logfile.c_str(), "a");
+ if(!logfp) {
+ fprintf(stderr, "Could not write to logfile: '%s'\n", optarg);
+ logfp = stderr;
+ }
+ debug_init(logfp);
+ }
+
if(debugstr) {
debug_parse(debugstr);
}
@@ -304,5 +320,7 @@ int main(int argc, char *argv[])
if(user) free(user);
if(group) free(group);
+ if(logfp != stderr) fclose(logfp);
+
return 0;
}