Log banner from global_init(). This puts it at the very top of the log,
right when the daemon starts.
Fixes: #2940
Signed-off-by: Sage Weil <sage@inktank.com>
We shouldn't always send these to stderr. (Among other things, the
warning: prefix breaks the gitbuilder error detection.)
Signed-off-by: Sage Weil <sage@inktank.com>
We were verifying that there was only 1 thread (the presumably main()) when
we call daemonize. However, with the new logging code, we stop a thread
right before the check, and /proc apparently updates asynchronously such
that our attempt to count running threads gives us a bad answer.
Just remove this kludgey check; we'll have to catch this class of bugs
the hard way.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
There are plenty of scenarios where the user doesn't need a config file.
Instead, just print a warning and let things move on.
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
There is nobody responding to CLOSE_STDERR, but this block sure looks
like it should be doing so. Fix that!
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
Set this up in either global_init() or common_init_finish(), both opportune
times that occur after config parsing has happened and the user has the
option to modify this behavior. The exception would be libraries like
librados, which can't use rados_conf_* to enable this. Arguably flush
functionality should be exposed through the librados API directly, instead
of futzing with on_exit().
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This will let you specify which cluster to talk to on the command line
(e.g., 'ceph -C foo ...' or when starting a daemon).
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
- explicitly defined subsystems, and ceph_subsys_FOO enums to go with them
- modular log system with Entry object
- separate gather level and log level
- drop lots of DoutStreambuf hackery
Signed-off-by: Sage Weil <sage@newdream.net>
We want to be able to provide alternative default config values, than
the ones we set in common/config_opts.h. This can be useful when we
want different default for different modules (e.g., rgw, rgw-admin).
Just passing it on the command line won't do because then we'd override
any config set by the user, so we need to process that before the regular
parsing (but after initializing the config context).
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Based on http://evbergen.home.xs4all.nl/unix-signals.html.
Instead of his design, though, we write single bytes, and create a pipe per
signal we have handlers registered for.
Signed-off-by: Sage Weil <sage@newdream.net>
This eliminates some flags and avoids annoying cases where the banner is
printed but we don't want to see it.
Signed-off-by: Sage Weil <sage@newdream.net>
Fix a bug that made it impossible to turn off logging to a file.
Remove the old "log_dir" setting. It has been deprecated for a long
time, and it adds a lot of complexity to the code.
heap_profiler: use the directory that log_file is in to construct a
profiler output file name. Don't use log_dir.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Formerly, CEPH_CONF was not respected by libraries. But now it is.
It overrides the default when reading the config file.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Now that the libraries have been de-globalized, this funtion should only
be used by global_init itself.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Initialize g_ceph_context in common_preinit rather than in a global
constructor.
Add comments to all of the major initialization functions.
We still set globals in common_preinit, for the time being.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Create test_libcommon_build to test for references to g_ceph_context and
other libglobal symbols from within libcommon.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Implement a simple registration system so that assert output can still
show up non-interleaved in daemons and utilities. Library code will just
use dout_emergency, which is simple and deadlock-free, but might be
interleaved with ongoing messages sometimes.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>