8153174: Remove trailing comma from log configuration listings
authormlarsson
Mon, 04 Apr 2016 08:58:38 +0200
changeset 37239 a6cda2376a19
parent 37237 7e5787f48bae
child 37240 ddd59c67dc03
8153174: Remove trailing comma from log configuration listings Reviewed-by: rehn, sla
hotspot/src/share/vm/logging/log.cpp
hotspot/src/share/vm/logging/logOutput.cpp
--- a/hotspot/src/share/vm/logging/log.cpp	Sat Apr 02 05:39:25 2016 +0200
+++ b/hotspot/src/share/vm/logging/log.cpp	Mon Apr 04 08:58:38 2016 +0200
@@ -124,7 +124,7 @@
 
   // Enable 'logging=info', verifying it has been set
   LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(logging));
-  assert_str_eq("logging=info,", stdoutput->config_string());
+  assert_str_eq("logging=info", stdoutput->config_string());
   assert(log_is_enabled(Info, logging), "logging was not properly enabled");
 
   // Enable 'gc=debug' (no wildcard), verifying no other tags are enabled
--- a/hotspot/src/share/vm/logging/logOutput.cpp	Sat Apr 02 05:39:25 2016 +0200
+++ b/hotspot/src/share/vm/logging/logOutput.cpp	Mon Apr 04 08:58:38 2016 +0200
@@ -56,6 +56,11 @@
   }
 
   size_t offset = strlen(_config_string);
+  if (offset > 0) {
+    // Add commas in-between tag and level combinations in the config string
+    _config_string[offset++] = ',';
+  }
+
   for (;;) {
     int ret = ts->label(_config_string + offset, _config_string_buffer_size - offset, "+");
     if (ret == -1) {
@@ -69,7 +74,7 @@
 
   offset = strlen(_config_string);
   for (;;) {
-    int ret = jio_snprintf(_config_string + offset, _config_string_buffer_size - offset, "=%s,", LogLevel::name(level));
+    int ret = jio_snprintf(_config_string + offset, _config_string_buffer_size - offset, "=%s", LogLevel::name(level));
     if (ret == -1) {
       _config_string_buffer_size *= 2;
       _config_string = REALLOC_C_HEAP_ARRAY(char, _config_string, _config_string_buffer_size, mtLogging);