Exemplo n.º 1
0
void JournalLogProvider::Log(AbstractLogProvider::LogLevel level,
                             const char *message,
                             const char *fileName,
                             int line,
                             const char *function) const
{
    try {
        sd_journal_send("PRIORITY=%d", journalLevel.at(level),
                "CODE_FILE=%s", fileName,
                "CODE_FUNC=%s", function,
                "CODE_LINE=%d", line,
                // add file, line & function info to log message
                "MESSAGE=[%s:%d] %s(): %s", fileName, line, function, message,
                NULL);
    } catch (const std::out_of_range&) {
        sd_journal_send(
                "PRIORITY=%d", LOG_ERR,
                "CODE_FILE=%s", fileName,
                "CODE_FUNC=%s", function,
                "CODE_LINE=%d", line,
                // add file, line & function info to log message
                "MESSAGE=[%s:%d] %s(): Unsupported log level %d", fileName, line, function, level,
                NULL);
    }
}
Exemplo n.º 2
0
static int update_pid_file(struct runtime_config *rtc)
{
	FILE *fd;
	char *pidfile;

	if (access(rtc->statedir, W_OK))
		if (mkdir(rtc->statedir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
			return 1;
	pidfile = construct_pidfile(rtc);
	if (!(fd = fopen(pidfile, "w"))) {
#ifdef USE_SYSTEMD
		sd_journal_send("MESSAGE=could not open file",
				"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_ERROR),
				"PID_FILE=%s", pidfile, "STRERROR=%s", strerror(errno), "PRIORITY=3", NULL);
#else
		syslog(LOG_ERR, "could not open file: %s: %s", pidfile, strerror(errno));
#endif
		return 1;
	}
	fprintf(fd, "%u %d", getpid(), rtc->msg_type);
	if (close_stream(fd))
#ifdef USE_SYSTEMD
		sd_journal_send("MESSAGE=close failed",
				"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_ERROR),
				"PID_FILE=%s", pidfile, "STRERROR=%s", strerror(errno), "PRIORITY=3", NULL);
#else
		syslog(LOG_ERR, "close failed: %s: %s", pidfile, strerror(errno));
#endif
	free(pidfile);
	return 0;
}
Exemplo n.º 3
0
static tlog_grc
tlog_journal_json_writer_write(struct tlog_json_writer *writer,
                               size_t id, const uint8_t *buf, size_t len)
{
    struct tlog_journal_json_writer *journal_json_writer =
                                    (struct tlog_journal_json_writer*)writer;
    int sd_rc;

#define BASE_ARGS \
    "PRIORITY=%d", journal_json_writer->priority,   \
    "MESSAGE=%.*s", len, buf

    if (journal_json_writer->augment) {
        sd_rc = sd_journal_send(
                    "TLOG_REC=%s", journal_json_writer->recording,
                    "TLOG_USER=%s", journal_json_writer->username,
                    "TLOG_SESSION=%u", journal_json_writer->session_id,
                    "TLOG_ID=%zu", id,
                    BASE_ARGS,
                    NULL);
    } else {
        sd_rc = sd_journal_send(BASE_ARGS, NULL);
    }

#undef BASE_ARGS

    return (sd_rc < 0) ? TLOG_GRC_FROM(systemd, sd_rc) : TLOG_RC_OK;
}
Exemplo n.º 4
0
static void run_server(struct runtime_config *rtc)
{
	struct sockaddr_in client_addr;
	socklen_t addr_len;
	pthread_attr_t attr;
#ifdef USE_SYSTEMD
	int ret;

	ret = sd_listen_fds(0);
	if (1 < ret)
		faillog("no or too many file descriptors received");
	else if (ret == 1)
		rtc->server_s = SD_LISTEN_FDS_START + 0;
	else {
#endif
		if (!(rtc->server_s = socket(rtc->res->ai_family, rtc->res->ai_socktype, rtc->res->ai_protocol)))
			err(EXIT_FAILURE, "cannot create socket");
		if (bind(rtc->server_s, rtc->res->ai_addr, rtc->res->ai_addrlen))
			err(EXIT_FAILURE, "unable to bind");
		if (listen(rtc->server_s, SOMAXCONN))
			err(EXIT_FAILURE, "unable to listen");
#ifdef USE_SYSTEMD
	}
#endif
	if (pthread_attr_init(&attr))
		err(EXIT_FAILURE, "cannot init thread attribute");

	if (pthread_rwlock_init(&(rtc->lock), NULL))
		err(EXIT_FAILURE, "cannot init read-write lock");

	daemonize();
	if (rtc->msg_type == STATE_UNKNOWN)
		read_status_from_file(rtc);
	if (update_pid_file(rtc))
		faillog("cannot write pid file");
	openlog(PACKAGE_NAME, LOG_PID, LOG_DAEMON);
	signal(SIGHUP, stop_server);
	signal(SIGINT, stop_server);
	signal(SIGTERM, stop_server);
#ifdef USE_SYSTEMD
	sd_journal_send("MESSAGE=service started",
			"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_STOP_START),
			"STATE=%s", state_messages[rtc->msg_type], "PRIORITY=6", NULL);
#else
	syslog(LOG_INFO, "started in state %s", state_messages[rtc->msg_type]);
#endif

	while (1) {
		int accepted;
		pthread_t thread;
		int *newsock;

		addr_len = sizeof(client_addr);
		accepted = accept(rtc->server_s, (struct sockaddr *)&client_addr, &addr_len);
		newsock = malloc(sizeof(int));
		*newsock = accepted;
		pthread_create(&thread, NULL, handle_request, newsock);
		pthread_detach(thread);
	}
}
Exemplo n.º 5
0
int main(int argc, char *argv[]) {
        pid_t pid;

        sd_journal_print(LOG_DEBUG, "Hi, I am a Screamer and I will make some mess in your Journal log.");
        sd_journal_print(LOG_NOTICE, "Let me note that you can see various message priorities in Journal and you can filter them.");
        sd_journal_print(LOG_ERR, "While previous messages are mostly informational, this one reports some error that happend in your system.");
        sd_journal_print(LOG_ALERT, "Error and Alert get same color, but the latter is much more severe.");

        sd_journal_send("MESSAGE=You may find some interesting details about logged messages in stored fields. Try to list all fields of messages from process %lu.", (unsigned long) getpid(),
                        "PRIORITY=%i", LOG_NOTICE,
                        "HOME=%s", getenv("HOME"),
                        NULL);

//          pid = fork();

//          if (pid == 0) {
//                  sleep(5);
//                  fprintf(stderr, L_ERROR "No! It's not true! That's impossible!!!\n");
//                  sleep(1);
//                  return 0;
//          } else if (pid > 0) {
//                  fprintf(stderr, L_NOTICE "Luke, I am your father!\n");
//          } else {
//                  return errno;
//          }

        sleep(2);
        return 0;
}
Exemplo n.º 6
0
static void debug_systemd_log(int msg_level,
			      const char *msg, const char *msg_no_nl)
{
	sd_journal_send("MESSAGE=%s", msg_no_nl,
			"PRIORITY=%d", debug_level_to_priority(msg_level),
			"LEVEL=%d", msg_level,
			NULL);
}
Exemplo n.º 7
0
    faillog(char *msg)
{
#ifdef USE_SYSTEMD
	sd_journal_send("MESSAGE=%s", msg,
			"STRERROR=%s", strerror(errno),
			"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_ERROR), "PRIORITY=3", NULL);
#else
	syslog(LOG_ERR, "%s: %s", msg, strerror(errno));
#endif
	exit(EXIT_FAILURE);
}
Exemplo n.º 8
0
static void stop_server(int sig __attribute__ ((__unused__)))
{
	pthread_rwlock_destroy(&(rtc.lock));
	freeaddrinfo(rtc.res);
	close(rtc.server_s);

#ifdef USE_SYSTEMD
	sd_journal_send("MESSAGE=service stopped", "MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_STOP_START), "PRIORITY=6", NULL);
#else
	syslog(LOG_INFO, "stopped");
#endif
	closelog();
}
Exemplo n.º 9
0
static void catch_signals(int signal)
{
	if (pthread_rwlock_wrlock(&rtc.lock)) {
#ifdef USE_SYSTEMD
		sd_journal_send("MESSAGE=could not get lock",
				"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_ERROR),
				"STRERROR=%s", strerror(errno), "PRIORITY=3", NULL);
#else
		syslog(LOG_ERR, "could not get lock");
#endif
		return;
	}
	switch (signal) {
	case SIGUSR1:
		rtc.msg_type = STATE_DISABLE;
		break;
	case SIGUSR2:
		rtc.msg_type = STATE_MAINTENANCE;
		break;
	case SIGWINCH:
		rtc.msg_type = STATE_ENABLE;
		break;
	default:
		/* should be impossible to reach */
		abort();
	}
	rtc.msg_len = strlen(state_messages[rtc.msg_type]);
	update_pid_file(&rtc);
	pthread_rwlock_unlock(&(rtc.lock));
#ifdef USE_SYSTEMD
	sd_journal_send("MESSAGE=signal received",
			"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_STATE_CHANGE),
			"NEW_STATE=%s", state_messages[rtc.msg_type], "PRIORITY=6", NULL);
#else
	syslog(LOG_INFO, "signal received, state is %s", state_messages[rtc.msg_type]);
#endif
	closelog();
}
Exemplo n.º 10
0
static int print_it(const char const *formatwithtid, const char const *msg, int log_level) {
    int ret;
    // fusedav-valhalla standardizing on names BINDING, SITE, and ENVIRONMENT
    ret = sd_journal_send("MESSAGE=%s%s", formatwithtid, msg,
                          "PRIORITY=%d", log_level,
                          "USER_AGENT=%s", get_user_agent(),
                          "SITE=%s", log_key_value[SITE],
                          "ENVIRONMENT=%s", log_key_value[ENVIRONMENT],
                          "HOST_ADDRESS=%s", log_key_value[HOST_ADDRESS],
                          "TID=%lu", syscall(SYS_gettid),
                          "PACKAGE_VERSION=%s", PACKAGE_VERSION,
                          NULL);
    return ret;
}
Exemplo n.º 11
0
void AuditLog::log(const PolicyKey &policyKey, const PolicyResult &policyResult) {
    if (m_logLevel == AL_NONE)
        return;

    PolicyType policyType = policyResult.policyType();
    namespace PPT = PredefinedPolicyType;

    if (m_logLevel == AL_ALL || (m_logLevel == AL_DENY && policyType == PPT::DENY) ||
        (m_logLevel == AL_ALLOW && policyType == PPT::ALLOW) ||
        (m_logLevel == AL_OTHER && policyType != PPT::ALLOW && policyType != PPT::DENY)) {
            sd_journal_send("MESSAGE=%s;%s;%s => %s", policyKey.client().toString().c_str(),
                            policyKey.user().toString().c_str(),
                            policyKey.privilege().toString().c_str(),
                            policyResultToString(policyResult), "PRIORITY=%i", LOG_INFO,
                            "CYNARA_LOG_TYPE=AUDIT", NULL);
    }
}
Exemplo n.º 12
0
  void JournaldLogHandler::log(const qi::LogLevel verb,
                               const char* category,
                               const char* msg,
                               const char* file,
                               const char* fct,
                               const int line)
  {
    // systemd uses the log level defined by syslog.
    // Here is how we mix both.
    // LOG_EMERG(0)   LogLevel_Fatal(1)
    // LOG_ALERT(1)
    // LOG_CRIT(2)
    // LOG_ERR(3)     LogLevel_Error(2)
    // LOG_WARNING(4) LogLevel_Warning(3)
    // LOG_NOTICE(5)  LogLevel_Info(4)
    // LOG_INFO(6)    LogLevel_Verbose(5)
    // LOG_DEBUG(7)   LogLevel_Debug(6)
    int _verb = static_cast<int>(verb);
    if (_verb == 1) _verb = 0;
    else _verb += 1;

    int i = sd_journal_send("MESSAGE=%s",     msg,
                            "QI_CATEGORY=%s", category,
                            "PRIORITY=%i",    _verb,
                            "CODE_FILE=%s",   file,
                            "CODE_LINE=%i",   line,
                            "CODE_FUNC=%s",   fct,
                            NULL
                           );
    if (i == 0)
      return;

    // If it fail try to do a simpler call to journald
    int j = sd_journal_print(_verb, "%s; %s", category, msg);
    if (j == 0)
      return;

    // If it fail again print an error message
    std::cerr << "Can't send message to journald." << std::endl;
  }
Exemplo n.º 13
0
int main(int argc, char **argv)
{
	int c, server = 0;
	char *listen = NULL, *port = PORT_NUM;
	struct addrinfo hints;
	int e;
	enum {
		STATEDIR_OPT = CHAR_MAX + 1
	};

	static const struct option longopts[] = {
		{"disable", no_argument, NULL, 'd'},
		{"maintenance", no_argument, NULL, 'm'},
		{"enable", no_argument, NULL, 'e'},
		{"server", no_argument, NULL, 's'},
		{"listen", required_argument, NULL, 'l'},
		{"port", required_argument, NULL, 'p'},
		{"state", required_argument, NULL, STATEDIR_OPT},
		{"version", no_argument, NULL, 'V'},
		{"help", no_argument, NULL, 'h'},
		{NULL, 0, NULL, 0}
	};

	set_program_name(argv[0]);
	atexit(close_stdout);

	memset(&rtc, 0, sizeof(struct runtime_config));
	rtc.argv = argv;
	rtc.statedir = F5GS_RUNDIR;

	while ((c = getopt_long(argc, argv, "dmesl:p:Vh", longopts, NULL)) != -1) {
		switch (c) {
		case 'd':
			rtc.send_signal = state_signals[STATE_DISABLE];
			break;
		case 'm':
			rtc.send_signal = state_signals[STATE_MAINTENANCE];
			break;
		case 'e':
			rtc.send_signal = state_signals[STATE_ENABLE];
			break;
		case 's':
			server = 1;
			break;
		case 'l':
			listen = optarg;
			break;
		case 'p':
			port = optarg;
			break;
		case STATEDIR_OPT:
			rtc.statedir = optarg;
			break;
		case 'V':
			printf("%s version %s", PACKAGE_NAME, PACKAGE_VERSION);
#ifdef USE_SYSTEMD
			puts(" with systemd support");
#else
			puts("");
#endif
			return EXIT_SUCCESS;
		case 'h':
			usage(stdout);
		default:
			usage(stderr);
		}
	}

	if (signal(state_signals[STATE_DISABLE], catch_signals) == SIG_ERR ||
	    signal(state_signals[STATE_MAINTENANCE], catch_signals) == SIG_ERR ||
	    signal(state_signals[STATE_ENABLE], catch_signals) == SIG_ERR)
		err(EXIT_FAILURE, "cannot set signal handler");

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	hints.ai_flags = AI_PASSIVE;
	e = getaddrinfo(listen, port, &hints, &(rtc.res));
	if (e) {
		warnx("getaddrinfo: %s port %s: %s", listen, port, gai_strerror(e));
		exit(EXIT_FAILURE);
	}

	if (rtc.send_signal && server)
		change_state(&rtc, getpid());
	else if (server) {
		rtc.msg_type = STATE_UNKNOWN;
		rtc.msg_len = strlen(state_messages[STATE_UNKNOWN]);
	} else if (rtc.send_signal) {
		char *eptr;
		pid_t pid;
		FILE *pidfd;
		char *pid_file = construct_pidfile(&rtc);
		if (!(pidfd = fopen(pid_file, "r")))
			err(EXIT_FAILURE, "cannot open pid file: %s", pid_file);
		fscanf(pidfd, "%d", &pid);
		if (close_stream(pidfd))
#ifdef USE_SYSTEMD
			sd_journal_send("MESSAGE=close failed",
					"PID_FILE=%s", pid_file,
					"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_ERROR),
					"STRERROR=%s", strerror(errno), "PRIORITY=3", NULL);
#else
			syslog(LOG_ERR, "close failed: %s: %s", pid_file, strerror(errno));
#endif
		free(pid_file);
		if (change_state(&rtc, pid)) {
			if (errno == 0) {
				errx(EXIT_FAILURE, "execution of %s failed", F5GS_PRE);
			} else {
				err(EXIT_FAILURE, "sending signal failed");
			}
		}
		openlog(PACKAGE_NAME, LOG_PID, LOG_DAEMON);
		eptr = getenv("USER");
		if (eptr != NULL)
#ifdef USE_SYSTEMD
			sd_journal_send("MESSAGE=signal was sent",
					"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_STATE_CHANGE),
					"USER=%s", eptr, "PRIORITY=6", NULL);
#else
			syslog(LOG_INFO, "signal was sent by USER: %s", eptr);
#endif
		eptr = getenv("SUDO_USER");
		if (eptr != NULL)
#ifdef USE_SYSTEMD
			sd_journal_send("MESSAGE=signal was sent",
					"MESSAGE_ID=%s", SD_ID128_CONST_STR(MESSAGE_STATE_CHANGE),
					"SUDO_USER=%s", eptr, "PRIORITY=6", NULL);
#else
			syslog(LOG_INFO, "signal was sent by SUDO_USER: %s", eptr);
#endif
	}

	if (server)
		run_server(&rtc);

	printf("current status is: %s\n", get_server_status(&rtc));

	freeaddrinfo(rtc.res);

	return EXIT_SUCCESS;
}
Exemplo n.º 14
0
#include "stdlog-intern.h"
#include "stdlog.h"

/* dummies just needed for driver interface */
static void jrnl_init(stdlog_channel_t __attribute__((unused)) ch) { }
static void jrnl_open(stdlog_channel_t __attribute__((unused)) ch) { }
static void jrnl_close(stdlog_channel_t __attribute__((unused)) ch) { }

static int
jrnl_log(stdlog_channel_t ch, const int severity,
	const char *fmt, va_list ap,
	char *__restrict__ const wrkbuf, const size_t buflen)
{
	int r;
	ch->vsnprintf(wrkbuf, buflen, fmt, ap);
	r = sd_journal_send("MESSAGE=%s", wrkbuf,
                "PRIORITY=%d", severity,
                NULL);
	if(r) errno = -r;
	return r;
}

void
__stdlog_set_jrnl_drvr(stdlog_channel_t ch)
{
	ch->drvr.init = jrnl_init;
	ch->drvr.open = jrnl_open;
	ch->drvr.close = jrnl_close;
	ch->drvr.log = jrnl_log;
}
Exemplo n.º 15
0
Arquivo: log.c Projeto: jkadlec/knot
static int emit_log_msg(int level, const char *zone, size_t zone_len, const char *msg)
{
	rcu_read_lock();
	struct log_sink *log = s_log;
	if(!log_isopen()) {
		rcu_read_unlock();
		return KNOT_ERROR;
	}

	int ret = 0;
	uint8_t *f = facility_at(log, LOGT_SYSLOG);
	logsrc_t src = zone ? LOG_ZONE : LOG_SERVER;

	// Syslog
	if (facility_levels(f, src) & LOG_MASK(level)) {
#ifdef ENABLE_SYSTEMD
		char *zone_fmt = zone ? "ZONE=%.*s" : NULL;
		sd_journal_send("PRIORITY=%d", level,
		                "MESSAGE=%s", msg,
		                zone_fmt, zone_len, zone,
		                NULL);
#else
		syslog(level, "%s", msg);
#endif
		ret = 1; // To prevent considering the message as ignored.
	}

	// Convert level to mask
	level = LOG_MASK(level);

	/* Prefix date and time. */
	char tstr[LOG_BUFLEN] = {0};
	struct tm lt;
	struct timeval tv;
	gettimeofday(&tv, NULL);
	time_t sec = tv.tv_sec;
	if (localtime_r(&sec, &lt) != NULL) {
		strftime(tstr, sizeof(tstr), KNOT_LOG_TIME_FORMAT " ", &lt);
	}

	// Log streams
	for (int i = LOGT_STDERR; i < LOGT_FILE + log->file_count; ++i) {

		// Check facility levels mask
		f = facility_at(log, i);
		if (facility_levels(f, src) & level) {

			// Select stream
			FILE *stream;
			switch(i) {
			case LOGT_STDERR: stream = stderr; break;
			case LOGT_STDOUT: stream = stdout; break;
			default: stream = log->file[i - LOGT_FILE]; break;
			}

			// Print
			ret = fprintf(stream, "%s%s\n", tstr, msg);
			if (stream == stdout) {
				fflush(stream);
			}
		}
	}

	rcu_read_unlock();

	if (ret < 0) {
		return KNOT_EINVAL;
	}

	return ret;
}
Exemplo n.º 16
0
BEGINdoAction
	msg_t *pMsg;
	uchar *tag;
	int lenTag;
	int sev;
	int r;
CODESTARTdoAction
	pMsg = (msg_t*) ppString[0];
	MsgGetSeverity(pMsg, &sev);
	getTAG(pMsg, &tag, &lenTag);
	/* we can use more properties here, but let's see if there
	 * is some real user interest. We can always add later...
	 */
	r = sd_journal_send("MESSAGE=%s", getMSG(pMsg),
                "PRIORITY=%d", sev,
		"SYSLOG_FACILITY=%d", pMsg->iFacility,
		"SYSLOG_IDENTIFIER=%s", tag,
                NULL);
	/* FIXME: think about what to do with errors ;) */
	(void) r; /* prevent compiler warning */
ENDdoAction


BEGINparseSelectorAct
CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(1)
	if(!strncmp((char*) p, ":omjournal:", sizeof(":omjournal:") - 1)) {
		errmsg.LogError(0, RS_RET_LEGA_ACT_NOT_SUPPORTED,
			"omjournal supports only v6+ config format, use: "
			"action(type=\"omjournal\" ...)");
	}
Exemplo n.º 17
0
void
cockpit_journal_log_handler (const gchar *log_domain,
                             GLogLevelFlags log_level,
                             const gchar *message,
                             gpointer user_data)
{
  gboolean to_journal = TRUE;
  int priority;
  const gchar *domains;

  /* In case we have generate our own log lines */
  const gchar *prefix;

  /*
   * Note: we should not call GLib fucntions here.
   *
   * Mapping glib log levels to syslog priorities
   * is not at all obvious.
   */

  switch (log_level & G_LOG_LEVEL_MASK)
    {
    /*
     * In GLib this is always fatal, caller of this
     * function aborts()
     */
    case G_LOG_LEVEL_ERROR:
      priority = LOG_CRIT;
      prefix = "ERROR";
      break;

    /*
     * By convention in GLib applications, critical warnings
     * are usually internal programmer error (ie: precondition
     * failures). This maps well to LOG_CRIT.
     */
    case G_LOG_LEVEL_CRITICAL:
      priority = LOG_CRIT;
      prefix = "CRITICAL";
      break;

    /*
     * By convention in GLib apps, g_warning() is used for
     * non-fatal problems, but ones that should be corrected
     * or not be encountered in normal system behavior.
     */
    case G_LOG_LEVEL_WARNING:
      priority = LOG_ERR;
      prefix = "WARNING";
      break;

    /*
     * These are related to bad input, or other hosts behaving
     * badly. Map well to syslog warnings.
     */
    case G_LOG_LEVEL_MESSAGE:
    default:
      priority = LOG_WARNING;
      prefix = "MESSAGE";
      break;

    /* Informational messages, startup, shutdown etc. */
    case G_LOG_LEVEL_INFO:
      priority = LOG_INFO;
      prefix = "INFO";
      break;

    /* Debug messages. */
    case G_LOG_LEVEL_DEBUG:
      domains = g_getenv ("G_MESSAGES_DEBUG");
      if (domains == NULL ||
          (strcmp (domains, "all") != 0 && (!log_domain || !strstr (domains, log_domain))))
        {
          to_journal = FALSE;
        }

      priority = LOG_INFO;
      prefix = "DEBUG";
      break;
    }

  if (to_journal)
    {
      if (have_journal)
        {
          sd_journal_send ("MESSAGE=%s", message,
                           "PRIORITY=%d", (int)priority,
                           "COCKPIT_DOMAIN=%s", log_domain ? log_domain : "",
                           NULL);
        }
      else if (old_handler == NULL)
        {
            g_printerr ("%s: %s: %s\n",
                        prefix,
                        log_domain ? log_domain : "Unknown",
                        message);
        }
    }

  /* After journal, since this may have side effects */
  if (old_handler)
    old_handler (log_domain, log_level, message, NULL);
}