Default target of log messages is stdout and ERRORs are sent there by default.
This is quite a change from the behavior of previous versions - no logging was sent anywhere unless --enable-debug was specified at ./configure time. Signed-off-by: Peter Schiffer <pschi...@redhat.com> --- include/libcgroup/init.h | 4 ++++ include/libcgroup/log.h | 2 ++ src/api.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h index 3709096..5150f2f 100644 --- a/include/libcgroup/init.h +++ b/include/libcgroup/init.h @@ -35,6 +35,10 @@ __BEGIN_DECLS /** * Initialize libcgroup. Information about mounted hierarchies are examined * and cached internally (just what's mounted where, not the groups themselves). + * + * If the cgroup logging was not set using cgroup_set_logger() or + * cgroup_set_default_logger() before calling cgroup_init(), the default logger + * is automatically set, logging CGROUP_LOG_ERROR messages. */ int cgroup_init(void); diff --git a/include/libcgroup/log.h b/include/libcgroup/log.h index d504ae3..356eefb 100644 --- a/include/libcgroup/log.h +++ b/include/libcgroup/log.h @@ -29,6 +29,8 @@ __BEGIN_DECLS * @par * The logging callback can be set at any time, but setting the callback before * any other libcgroup function (including cgroup_init()) is highly recommended. + * If no logger is set before cgroup_init() is called, default logger is + * automatically set, logging CGROUP_LOG_ERROR messages to stdout. * * @par Setting log level * Some of the functions below set the log level as integer. diff --git a/src/api.c b/src/api.c index 2851efd..43acd32 100644 --- a/src/api.c +++ b/src/api.c @@ -854,6 +854,8 @@ int cgroup_init(void) char mntent_buffer[4 * FILENAME_MAX]; char *strtok_buffer = NULL; + cgroup_set_default_logger(-1); + pthread_rwlock_wrlock(&cg_mount_table_lock); /* free global variables filled by previous cgroup_init() */ ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel