8143229: Replace the develop level with develop macros in Unified Logging
authormlarsson
Fri, 20 Nov 2015 12:42:21 +0100
changeset 34252 59d76c40998a
parent 34251 0ce22a6d7d8c
child 34253 ba3946143842
child 34255 04528c2bb8b2
child 34259 06047e5d60d2
child 34262 43560e879d6d
8143229: Replace the develop level with develop macros in Unified Logging Reviewed-by: brutisso, coleenp, dholmes, rprotacio
hotspot/src/share/vm/logging/log.cpp
hotspot/src/share/vm/logging/log.hpp
hotspot/src/share/vm/logging/logConfiguration.cpp
hotspot/src/share/vm/logging/logLevel.hpp
--- a/hotspot/src/share/vm/logging/log.cpp	Wed Nov 11 15:45:17 2015 +0100
+++ b/hotspot/src/share/vm/logging/log.cpp	Fri Nov 20 12:42:21 2015 +0100
@@ -37,10 +37,10 @@
 
   // Write long message to output file
   MutexLocker ml(LogConfiguration_lock);
-  LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=develop",
+  LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=trace",
     NULL, NULL, NULL);
   ResourceMark rm;
-  outputStream* logstream = LogHandle(logging)::develop_stream();
+  outputStream* logstream = LogHandle(logging)::trace_stream();
   logstream->print_cr("01:1234567890-"
                       "02:1234567890-"
                       "03:1234567890-"
--- a/hotspot/src/share/vm/logging/log.hpp	Wed Nov 11 15:45:17 2015 +0100
+++ b/hotspot/src/share/vm/logging/log.hpp	Fri Nov 20 12:42:21 2015 +0100
@@ -49,11 +49,21 @@
 #define log_info(...)    (!log_is_enabled(Info, __VA_ARGS__))    ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
 #define log_debug(...)   (!log_is_enabled(Debug, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
 #define log_trace(...)   (!log_is_enabled(Trace, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
+
+// Macros for logging that should be excluded in product builds.
+// Available for levels Info, Debug and Trace. Includes test macro that
+// evaluates to false in product builds.
 #ifndef PRODUCT
-#define log_develop(...) (!log_is_enabled(Develop, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Develop>
+#define log_develop_info(...)  (!log_is_enabled(Info, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
+#define log_develop_debug(...) (!log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
+#define log_develop_trace(...) (!log_is_enabled(Trace, __VA_ARGS__))  ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
+#define develop_log_is_enabled(level, ...)  log_is_enabled(level, __VA_ARGS__)
 #else
 #define DUMMY_ARGUMENT_CONSUMER(...)
-#define log_develop(...) DUMMY_ARGUMENT_CONSUMER
+#define log_develop_info(...)  DUMMY_ARGUMENT_CONSUMER
+#define log_develop_debug(...) DUMMY_ARGUMENT_CONSUMER
+#define log_develop_trace(...) DUMMY_ARGUMENT_CONSUMER
+#define develop_log_is_enabled(...)  false
 #endif
 
 // Convenience macro to test if the logging is enabled on the specified level for given tags.
--- a/hotspot/src/share/vm/logging/logConfiguration.cpp	Wed Nov 11 15:45:17 2015 +0100
+++ b/hotspot/src/share/vm/logging/logConfiguration.cpp	Fri Nov 20 12:42:21 2015 +0100
@@ -44,6 +44,7 @@
   LogDiagnosticCommand::registerCommand();
   LogHandle(logging) log;
   log.info("Log configuration fully initialized.");
+  log_develop_info(logging)("Develop logging is available.");
   if (log.is_trace()) {
     ResourceMark rm;
     MutexLocker ml(LogConfiguration_lock);
--- a/hotspot/src/share/vm/logging/logLevel.hpp	Wed Nov 11 15:45:17 2015 +0100
+++ b/hotspot/src/share/vm/logging/logLevel.hpp	Fri Nov 20 12:42:21 2015 +0100
@@ -29,14 +29,8 @@
 
 // The list of log levels:
 //
-//  develop - A non-product level that is finer than trace.
-//            Should be used for really expensive and/or
-//            extensive logging, or logging that shouldn't
-//            or can't be included in a product build.
-//
-//  trace   - Finest level of logging in product builds.
-//            Use for extensive/noisy logging that can
-//            give slow-down when enabled.
+//  trace   - Finest level of logging. Use for extensive/noisy
+//            logging that can give slow-down when enabled.
 //
 //  debug   - A finer level of logging. Use for semi-noisy
 //            logging that is does not fit the info level.
@@ -49,7 +43,6 @@
 //  error   - Critical messages caused by errors.
 //
 #define LOG_LEVEL_LIST \
-  NOT_PRODUCT(LOG_LEVEL(Develop, develop)) \
   LOG_LEVEL(Trace, trace) \
   LOG_LEVEL(Debug, debug) \
   LOG_LEVEL(Info, info) \