mirror of https://github.com/sipwise/ngcpcfg.git
/var/log/ngcp/ngcpcfg.log might not contain error messages from ngcpcfg's sync-db script. This might be confusing when comparing output from the command line with the logged actions from ngcpcfg.log. As sync-db doesn't log all error messages to stderr anyway and we ignore exit code of the sync-db script as well (on purpose) let's just redirect stderr and stdout to the same file descriptor and then provide output to the console as well as syslog's ngcpcfg tag. Output before this change: | root@sp1:~# ngcpcfg commit "before" | 2016-10-25 22:12:20: Executing sync-db: | DBI connect('database=provisioning;host=localhost;port=3306','sipwise',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/ngcp-ngcpcfg/helper//sync-db line 70. | Error: Could not connect to database 'provisioning' at 'localhost:3306' as 'sipwise': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) | 2016-10-25 22:12:20: OK: nothing to commit. | 2016-10-25 22:12:20: Synchronizing MySQL grants/credentials | Can't connect to MySQL database 'mysql': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/sbin/ngcp-sync-grants line 66. | root@sp1:~# tail -f /var/log/ngcp/ngcpcfg.log | [...] | Oct 25 22:12:20 sp1 (notice) ngcpcfg: Executing sync-db: | Oct 25 22:12:20 sp1 (notice) ngcpcfg: OK: nothing to commit. | Oct 25 22:12:20 sp1 (notice) ngcpcfg: Checking state of /etc files | Oct 25 22:12:20 sp1 (notice) ngcpcfg: OK: nothing to commit. | Oct 25 22:12:20 sp1 (notice) ngcpcfg: Synchronizing MySQL grants/credentials Output after this change gets applied: | root@sp1:~# ngcpcfg commit "after" | 2016-10-25 22:12:59: Executing sync-db: | DBI connect('database=provisioning;host=localhost;port=3306','sipwise',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/ngcp-ngcpcfg/helper//sync-db line 70. | Error: Could not connect to database 'provisioning' at 'localhost:3306' as 'sipwise': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) | 2016-10-25 22:12:59: OK: nothing to commit. | 2016-10-25 22:12:59: Synchronizing MySQL grants/credentials | Can't connect to MySQL database 'mysql': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/sbin/ngcp-sync-grants line 66. | root@sp1:~# tail -f /var/log/ngcp/ngcpcfg.log | [...] | Oct 25 22:12:59 sp1 (notice) ngcpcfg: Executing sync-db: | Oct 25 22:12:59 sp1 (notice) ngcpcfg: DBI connect('database=provisioning;host=localhost;port=3306','sipwise',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/ngcp-ngcpcfg/helper//sync-db line 70. | Oct 25 22:12:59 sp1 (notice) ngcpcfg: Error: Could not connect to database 'provisioning' at 'localhost:3306' as 'sipwise': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) | Oct 25 22:12:59 sp1 (notice) ngcpcfg: OK: nothing to commit. | Oct 25 22:12:59 sp1 (notice) ngcpcfg: Checking state of /etc files | Oct 25 22:12:59 sp1 (notice) ngcpcfg: OK: nothing to commit. | Oct 25 22:12:59 sp1 (notice) ngcpcfg: Synchronizing MySQL grants/credentials Change-Id: Iabb0c0ab24e212b79b0dfa85947cb274a161cc00changes/59/9159/1
parent
b202549677
commit
44b55fad89
Loading…
Reference in new issue