You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/08/06 20:02:06 UTC
qpid-dispatch git commit: DISPATCH-1094 - Moved the creation and
writing of log file inside a lock so that the order is preserved. This closes
#353
Repository: qpid-dispatch
Updated Branches:
refs/heads/master b1013fd48 -> d28002a49
DISPATCH-1094 - Moved the creation and writing of log file inside a lock so that the order is preserved. This closes #353
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d28002a4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d28002a4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d28002a4
Branch: refs/heads/master
Commit: d28002a492abf73f9a12ad13c2a7c43007ca52c7
Parents: b1013fd
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Mon Aug 6 14:16:28 2018 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Mon Aug 6 15:55:28 2018 -0400
----------------------------------------------------------------------
src/log.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d28002a4/src/log.c
----------------------------------------------------------------------
diff --git a/src/log.c b/src/log.c
index c4c6c84..f0acd7a 100644
--- a/src/log.c
+++ b/src/log.c
@@ -310,7 +310,9 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry)
aprintf(&begin, end, "%s ", buf);
}
+
aprintf(&begin, end, "%s (%s) %s", entry->module, level->name, entry->text);
+
if (default_bool(log_source->includeSource, default_log_source->includeSource) && entry->file)
aprintf(&begin, end, " (%s:%d)", entry->file, entry->line);
aprintf(&begin, end, "\n");
@@ -403,6 +405,8 @@ void qd_vlog_impl(qd_log_source_t *source, qd_log_level_t level, const char *fil
if (!qd_log_enabled(source, level)) return;
+ // Bounded buffer of log entries, keep most recent.
+ sys_mutex_lock(log_lock);
qd_log_entry_t *entry = new_qd_log_entry_t();
DEQ_ITEM_INIT(entry);
entry->module = source->module;
@@ -412,9 +416,6 @@ void qd_vlog_impl(qd_log_source_t *source, qd_log_level_t level, const char *fil
gettimeofday(&entry->time, NULL);
vsnprintf(entry->text, TEXT_MAX, fmt, ap);
write_log(source, entry);
-
- // Bounded buffer of log entries, keep most recent.
- sys_mutex_lock(log_lock);
DEQ_INSERT_TAIL(entries, entry);
if (DEQ_SIZE(entries) > LIST_MAX)
qd_log_entry_free_lh(DEQ_HEAD(entries));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org