gconf r2584 - in trunk: . gconf
- From: kmaraas svn gnome org
- To: svn-commits-list gnome org
- Subject: gconf r2584 - in trunk: . gconf
- Date: Wed, 7 May 2008 11:21:25 +0100 (BST)
Author: kmaraas
Date: Wed May 7 10:21:24 2008
New Revision: 2584
URL: http://svn.gnome.org/viewvc/gconf?rev=2584&view=rev
Log:
2008-05-07 Kjartan Maraas <kmaraas gnome org>
* gconf/gconf-internals.c: (gconf_log):
* gconf/gconf-sources.c: (gconf_sources_new_from_addresses):
* gconf/gconfd.c: (main): Merge the desyslogification patch
from Debian. Also used in Fedora now. Closes bug #126468.
Modified:
trunk/ChangeLog
trunk/gconf/gconf-internals.c
trunk/gconf/gconf-sources.c
trunk/gconf/gconfd.c
Modified: trunk/gconf/gconf-internals.c
==============================================================================
--- trunk/gconf/gconf-internals.c (original)
+++ trunk/gconf/gconf-internals.c Wed May 7 10:21:24 2008
@@ -1097,105 +1097,46 @@
* Log
*/
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-
void
gconf_log(GConfLogPriority pri, const gchar* fmt, ...)
{
- gchar* msg;
va_list args;
-#ifdef HAVE_SYSLOG_H
- gchar* convmsg;
- int syslog_pri = LOG_DEBUG;
-#endif
+ GLogLevelFlags loglevel;
if (!gconf_log_debug_messages &&
pri == GCL_DEBUG)
return;
-
- va_start (args, fmt);
- msg = g_strdup_vprintf(fmt, args);
- va_end (args);
-#ifdef HAVE_SYSLOG_H
- if (gconf_daemon_mode)
+ switch (pri)
{
- switch (pri)
- {
- case GCL_EMERG:
- syslog_pri = LOG_EMERG;
- break;
-
- case GCL_ALERT:
- syslog_pri = LOG_ALERT;
- break;
-
- case GCL_CRIT:
- syslog_pri = LOG_CRIT;
- break;
-
- case GCL_ERR:
- syslog_pri = LOG_ERR;
- break;
-
- case GCL_WARNING:
- syslog_pri = LOG_WARNING;
- break;
-
- case GCL_NOTICE:
- syslog_pri = LOG_NOTICE;
- break;
-
- case GCL_INFO:
- syslog_pri = LOG_INFO;
- break;
-
- case GCL_DEBUG:
- syslog_pri = LOG_DEBUG;
- break;
-
- default:
- g_assert_not_reached();
- break;
- }
-
- convmsg = g_locale_from_utf8 (msg, -1, NULL, NULL, NULL);
- if (!convmsg)
- syslog (syslog_pri, "%s", msg);
- else
- {
- syslog (syslog_pri, "%s", convmsg);
- g_free (convmsg);
- }
+ case GCL_EMERG:
+ case GCL_ALERT:
+ case GCL_CRIT:
+ loglevel = G_LOG_LEVEL_ERROR;
+ break;
+ case GCL_ERR:
+ loglevel = G_LOG_LEVEL_CRITICAL;
+ break;
+ case GCL_WARNING:
+ loglevel = G_LOG_LEVEL_WARNING;
+ break;
+ case GCL_NOTICE:
+ loglevel = G_LOG_LEVEL_MESSAGE;
+ break;
+ case GCL_INFO:
+ loglevel = G_LOG_LEVEL_INFO;
+ break;
+ case GCL_DEBUG:
+ loglevel = G_LOG_LEVEL_DEBUG;
+ break;
+ default:
+ g_assert_not_reached();
+ break;
}
- else
-#endif
- {
- switch (pri)
- {
- case GCL_EMERG:
- case GCL_ALERT:
- case GCL_CRIT:
- case GCL_ERR:
- case GCL_WARNING:
- g_printerr ("%s\n", msg);
- break;
-
- case GCL_NOTICE:
- case GCL_INFO:
- case GCL_DEBUG:
- g_print ("%s\n", msg);
- break;
- default:
- g_assert_not_reached();
- break;
- }
- }
-
- g_free(msg);
+ va_start (args, fmt);
+ g_logv (G_LOG_DOMAIN, loglevel, fmt, args);
+ va_end (args);
}
/*
Modified: trunk/gconf/gconf-sources.c
==============================================================================
--- trunk/gconf/gconf-sources.c (original)
+++ trunk/gconf/gconf-sources.c Wed May 7 10:21:24 2008
@@ -407,20 +407,20 @@
if (source->flags & GCONF_SOURCE_ALL_WRITEABLE)
{
some_writable = TRUE;
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a writable configuration source at position %d"),
source->address, i);
}
else if (source->flags & GCONF_SOURCE_NEVER_WRITEABLE)
{
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a read-only configuration source at position %d"),
source->address, i);
}
else
{
some_writable = TRUE;
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a partially writable configuration source at position %d"),
source->address, i);
}
Modified: trunk/gconf/gconfd.c
==============================================================================
--- trunk/gconf/gconfd.c (original)
+++ trunk/gconf/gconfd.c Wed May 7 10:21:24 2008
@@ -49,9 +49,6 @@
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
#include <time.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@@ -500,41 +497,6 @@
return the_poa;
}
-static void
-log_handler (const gchar *log_domain,
- GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
-{
- GConfLogPriority pri = GCL_WARNING;
-
- switch (log_level & G_LOG_LEVEL_MASK)
- {
- case G_LOG_LEVEL_ERROR:
- case G_LOG_LEVEL_CRITICAL:
- pri = GCL_ERR;
- break;
-
- case G_LOG_LEVEL_WARNING:
- pri = GCL_WARNING;
- break;
-
- case G_LOG_LEVEL_MESSAGE:
- case G_LOG_LEVEL_INFO:
- pri = GCL_INFO;
- break;
-
- case G_LOG_LEVEL_DEBUG:
- pri = GCL_DEBUG;
- break;
-
- default:
- break;
- }
-
- gconf_log (pri, "%s", message);
-}
-
/* From ORBit2 */
/* There is a DOS attack if another user creates
* the given directory and keeps us from creating
@@ -598,8 +560,6 @@
#endif
CORBA_Environment ev;
CORBA_ORB orb;
- gchar* logname;
- const gchar* username;
gchar* ior;
int exit_code = 0;
GError *err;
@@ -647,27 +607,7 @@
gconf_set_daemon_mode(TRUE);
- /* Logs */
- username = g_get_user_name();
- logname = g_strdup_printf("gconfd (%s-%u)", username, (guint)getpid());
-
-#ifdef HAVE_SYSLOG_H
- openlog (logname, LOG_NDELAY, LOG_USER);
-#endif
-
- g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- /* openlog() does not copy logname - what total brokenness.
- So we free it at the end of main() */
-
- gconf_log (GCL_INFO, _("starting (version %s), pid %u user '%s'"),
+ gconf_log (GCL_DEBUG, _("starting (version %s), pid %u user '%s'"),
VERSION, (guint)getpid(), g_get_user_name());
#ifdef GCONF_ENABLE_DEBUG
@@ -835,14 +775,7 @@
daemon_lock = NULL;
- gconf_log (GCL_INFO, _("Exiting"));
-
-#ifdef HAVE_SYSLOG_H
- closelog ();
-#endif
-
- /* Can't do this due to stupid atexit() handler that calls g_log stuff */
- /* g_free (logname); */
+ gconf_log (GCL_DEBUG, _("Exiting"));
return exit_code;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]