aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn/ggsn.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-23 10:07:26 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-23 10:29:17 +0100
commit9c0ff4fafe4276396125a52c89d36967566fe08c (patch)
treeb1c337dd1ca34c82f99cd39f66b691df10caf244 /ggsn/ggsn.c
parent1c4d9e6d871a8fed3e1c600777a5b06726d53302 (diff)
cli: Introduce a logfile command to log errors to a file
The evolution would be to introduce libosmocore and start using the logging framework. But even then we can map this option to the file target. Fixes: SYS#263
Diffstat (limited to 'ggsn/ggsn.c')
-rw-r--r--ggsn/ggsn.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 1152519..0022b1b 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -283,6 +283,18 @@ int main(int argc, char **argv)
if (cmdline_parser_configfile(args_info.conf_arg, &args_info, 0, 0, 0)
!= 0)
exit(1);
+
+ /* Open a log file */
+ if (args_info.logfile_arg) {
+ FILE* log_file = fopen(args_info.logfile_arg, "a");
+ if (!log_file) {
+ printf("Failed to open logfile: '%s'\n",
+ args_info.logfile_arg);
+ exit(1);
+ }
+ sys_err_setlogfile(log_file);
+ }
+
if (args_info.debug_flag) {
printf("cmdline_parser_configfile\n");
printf("listen: %s\n", args_info.listen_arg);