On Mon, 2016-03-14 at 08:17 +0200, Ahmed S. Darwish wrote: > @@ -386,7 +386,7 @@ void pa_log_levelv_meta( > Â > Â Â Â Â Â /* We don't use dynamic memory allocation here to minimize the hit > Â Â Â Â Â Â * in RT threads */ > -Â Â Â Â char text[16*1024], location[128], timestamp[32]; > +Â Â Â Â char text[16*1024], location[128], timestamp[32], logging_error[120]; > Â > Â Â Â Â Â pa_assert(level < PA_LOG_LEVEL_MAX); > Â Â Â Â Â pa_assert(format); > @@ -507,24 +507,29 @@ void pa_log_levelv_meta( > Â > Â #ifdef HAVE_SYSTEMD_JOURNAL > Â Â Â Â Â Â Â Â Â Â Â Â Â case PA_LOG_JOURNAL: > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (sd_journal_send("MESSAGE=%s", t, > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if ((ret = sd_journal_send("MESSAGE=%s", t, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "PRIORITY=%i", level_to_journal[level], > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "CODE_FILE=%s", file, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "CODE_FUNC=%s", func, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "CODE_LINE=%d", line, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "PULSE_BACKTRACE=%s", pa_strempty(bt), > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL) < 0) { > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL)) < 0) { > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pa_log_target new_target = { .file = NULL, }; > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pa_snprintf(logging_error, sizeof(logging_error), "Error writing logs to journal. Reason: %s", > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pa_cstrerror(ret)); > Â #ifdef HAVE_SYSLOG_H > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pa_log_target new_target = { .type = PA_LOG_SYSLOG, .file = NULL }; > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â new_target.type = PA_LOG_SYSLOG; > Â > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â syslog(level_to_syslog[PA_LOG_ERROR], "%s%s%s", timestamp, __FILE__, > -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Error writing logs to the journal. Redirect log messages to syslog."); > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â log_syslog(PA_LOG_ERROR, logging_error, timestamp, NULL, NULL); > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â log_syslog(PA_LOG_ERROR, (char *)"Redirecting log messages to syslog.", timestamp, NULL, NULL); I think it would be better to change the log_syslog() prototype than to cast "const char *" to "char *" here. There's no good reason why log_syslog() needs to take a mutable string. Also, I think it makes sense to pass __FILE__ as the location instead of NULL, like the previous code did. -- Tanu