Skip to contentSkip to conversation

error: only prepend timestamp on stderr

PATCH In review Stefan Hajnoczi 4 participants 4 messages Aug 10, 2015 – Sep 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 error: only prepend timestamp on stderr

The -msg timestamp=on option prepends a timestamp to error messages. This is useful on stderr where it allows users to identify when an error was raised.

Timestamps do not make sense on the monitor since error_report() is called in response to a synchronous monitor command and the user already knows "when" the command was issued. Additionally, the rest of the monitor conversation lacks timestamps so the error timestamp cannot be correlated with other activity.

Only prepend timestamps on stderr. This fixes libvirt's 'drive_del' processing, which did not expect a timestamp. Other QEMU monitor clients are probably equally confused by timestamps on monitor error messages.

Cc Markus Armbruster <[email protected]>
Cc Seiji Aguchi <[email protected]>
Cc Frank Schreuder <[email protected]>
Cc Daniel P. Berrange <[email protected]>
---
 util/qemu-error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/qemu-error.c +1 -1
index 77ea6c6..c1574bb 100644
@@ -210,7 +210,7 @@ void error_vreport(const char *fmt, va_list ap)
     GTimeVal tv;
     gchar *timestr;
 
-    if (enable_timestamp_msg) {
+    if (enable_timestamp_msg && !cur_mon) {
         g_get_current_time(&tv);
         timestr = g_time_val_to_iso8601(&tv);
         error_printf("%s ", timestr);
Signature · 1 line
2.4.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 15 lines · Stefan Hajnoczi

The -msg timestamp=on option prepends a timestamp to error messages. This is useful on stderr where it allows users to identify when an error was raised.

Timestamps do not make sense on the monitor since error_report() is called in response to a synchronous monitor command and the user already knows "when" the command was issued. Additionally, the rest of the monitor conversation lacks timestamps so the error timestamp cannot be correlated with other activity.

Only prepend timestamps on stderr. This fixes libvirt's 'drive_del' processing, which did not expect a timestamp. Other QEMU monitor clients are probably equally confused by timestamps on monitor error messages.

Quoted 8 lines
Cc Markus Armbruster <[email protected]>
Cc Seiji Aguchi <[email protected]>
Cc Frank Schreuder <[email protected]>
Cc Daniel P. Berrange <[email protected]>
---
 util/qemu-error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
Tested-by on v2 1/1
#2 lore raw
In reply to Stefan Hajnoczi

Op 8/10/2015 om 3:15 PM schreef Stefan Hajnoczi:

Quoted 29 lines

The -msg timestamp=on option prepends a timestamp to error messages. This is useful on stderr where it allows users to identify when an error was raised.

Timestamps do not make sense on the monitor since error_report() is called in response to a synchronous monitor command and the user already knows "when" the command was issued. Additionally, the rest of the monitor conversation lacks timestamps so the error timestamp cannot be correlated with other activity.

Only prepend timestamps on stderr. This fixes libvirt's 'drive_del' processing, which did not expect a timestamp. Other QEMU monitor clients are probably equally confused by timestamps on monitor error messages.

Cc Markus Armbruster <[email protected]>
Cc Seiji Aguchi <[email protected]>
Cc Frank Schreuder <[email protected]>
Cc Daniel P. Berrange <[email protected]>
---
 util/qemu-error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/qemu-error.c +0 -0
index 77ea6c6..c1574bb 100644

util/qemu-error.c void error_vreport(const char *fmt, va_list ap) · line 216

Quoted 8 lines
util/qemu-error.c +1 -1
@@ -210,7 +210,7 @@ void error_vreport(const char *fmt, va_list ap)
     GTimeVal tv;
     gchar *timestr;
 
-    if (enable_timestamp_msg) {
+    if (enable_timestamp_msg && !cur_mon) {
         g_get_current_time(&tv);
         timestr = g_time_val_to_iso8601(&tv);
         error_printf("%s ", timestr);

Regards,
Frank

#3 lore raw
In reply to Stefan Hajnoczi
Quoted 15 lines · Stefan Hajnoczi

The -msg timestamp=on option prepends a timestamp to error messages. This is useful on stderr where it allows users to identify when an error was raised.

Timestamps do not make sense on the monitor since error_report() is called in response to a synchronous monitor command and the user already knows "when" the command was issued. Additionally, the rest of the monitor conversation lacks timestamps so the error timestamp cannot be correlated with other activity.

Only prepend timestamps on stderr. This fixes libvirt's 'drive_del' processing, which did not expect a timestamp. Other QEMU monitor clients are probably equally confused by timestamps on monitor error messages.

Quoted 5 lines
Cc Markus Armbruster <[email protected]>
Cc Seiji Aguchi <[email protected]>
Cc Frank Schreuder <[email protected]>
Cc Daniel P. Berrange <[email protected]>

I'll take this through my tree. Thanks!