diff options
author | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-01-05 11:04:49 -0800 |
---|---|---|
committer | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-01-05 15:53:36 -0800 |
commit | 8adaa0478a94b5f731ee77e12a8dac29e3a7b46a (patch) | |
tree | 9ee979769de1ced08700a849c2a889ed7c7c8d20 /src/test_trans.cc | |
parent | bba356b86641085aeb8b76cea3526622265bf387 (diff) | |
download | ceph-8adaa0478a94b5f731ee77e12a8dac29e3a7b46a.tar.gz |
common: make command-line programs log to stderr
command-line programs (as opposed to daemons) should send their logs to
stderr rather than to a log file, syslog, etc. This is especially
important because most users want to run the ceph command-line programs
as non-root, and often only root has permissions to add to the ceph
log directory.
Create a new function, set_foreground_logging, that overrides ceph.conf
settings to force all log output to stderr. For daemons, we still only
send the very highest priority messages to stderr, and only before they
daemonize().
Don't ever log to stdout because it interferes with scripts that parse
the output of stdout. Instead, log to stderr if the user gives the
--foreground or --nodaemon argument.
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
Diffstat (limited to 'src/test_trans.cc')
-rw-r--r-- | src/test_trans.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test_trans.cc b/src/test_trans.cc index 3fb7a288cd6..0c7bdb95f8b 100644 --- a/src/test_trans.cc +++ b/src/test_trans.cc @@ -37,6 +37,7 @@ int main(int argc, const char **argv) common_set_defaults(false); common_init(args, NULL, false); + set_foreground_logging(); // args if (args.size() < 2) return -1; |