On 05/12/2011 08:57 AM, Jan Safranek wrote: > Default target of log messages is stdout and WARNINGs 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: Jan Safranek<jsafr...@redhat.com> Acked-By: Ivana Hutarova Varekova <varek...@redhat.com>
> --- > > include/libcgroup/init.h | 4 ++++ > include/libcgroup/log.h | 2 ++ > src/api.c | 2 ++ > 3 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h > index 3709096..44badd2 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. > */ > int cgroup_init(void); > > diff --git a/include/libcgroup/log.h b/include/libcgroup/log.h > index 10b1248..ff9ecf5 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_WARNING and above 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 53c76e8..babf4cb 100644 > --- a/src/api.c > +++ b/src/api.c > @@ -769,6 +769,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); > > proc_cgroup = fopen("/proc/cgroups", "re"); > > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Libcg-devel mailing list > Libcg-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libcg-devel ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel