diff --git a/src/hotspot/share/logging/logTagSet.cpp b/src/hotspot/share/logging/logTagSet.cpp index 2a2f640e0c..4d6fe61925 100644 --- a/src/hotspot/share/logging/logTagSet.cpp +++ b/src/hotspot/share/logging/logTagSet.cpp @@ -39,8 +39,8 @@ size_t LogTagSet::_ntagsets = 0; // This constructor is called only during static initialization. // See the declaration in logTagSet.hpp for more information. -LogTagSet::LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4) - : _next(_list), _write_prefix(prefix_writer) { +LogTagSet::LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4, LogTagSet* tagset_4z ) + : _tagset_4z( tagset_4z ), _next(_list), _write_prefix(prefix_writer), _is_4z_tagset( LogTag::_4z == t0 ) { _tag[0] = t0; _tag[1] = t1; _tag[2] = t2; @@ -131,9 +131,15 @@ void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list args) { ret = os::vsnprintf(newbuf + prefix_len, newbuf_len - prefix_len, fmt, saved_args); assert(ret >= 0, "Log message buffer issue"); log(level, newbuf); + if ( is_level( level ) && !_is_4z_tagset && _tagset_4z && _tagset_4z->is_level( level ) ) { + _tagset_4z->log( level, newbuf ); + } FREE_C_HEAP_ARRAY(char, newbuf); } else { log(level, buf); + if ( is_level( level ) && !_is_4z_tagset && _tagset_4z && _tagset_4z->is_level( level ) ) { + _tagset_4z->log( level, buf ); + } } va_end(saved_args); } diff --git a/src/hotspot/share/logging/logTagSet.hpp b/src/hotspot/share/logging/logTagSet.hpp index 766e7a2a57..d19b45bce1 100644 --- a/src/hotspot/share/logging/logTagSet.hpp +++ b/src/hotspot/share/logging/logTagSet.hpp @@ -41,6 +41,7 @@ class LogTagSet { static LogTagSet* _list; static size_t _ntagsets; + LogTagSet* const _tagset_4z; LogTagSet* const _next; size_t _ntags; LogTagType _tag[LogTag::MaxTags]; @@ -50,13 +51,14 @@ class LogTagSet { typedef size_t (*PrefixWriter)(char* buf, size_t size); PrefixWriter _write_prefix; + bool const _is_4z_tagset; // Keep constructor private to prevent incorrect instantiations of this class. // Only LogTagSetMappings can create/contain instances of this class. // The constructor links all tagsets together in a global list of tagsets. // This list is used during configuration to be able to update all tagsets // and their configurations to reflect the new global log configuration. - LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4); + LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4, LogTagSet* tagset_4z = NULL ); template friend class LogTagSetMapping; @@ -141,6 +143,7 @@ private: // Verify number of logging tags does not exceed maximum supported. STATIC_ASSERT(GuardTag == LogTag::__NO_TAG); static LogTagSet _tagset; + static LogTagSet _tagset_4z; public: static LogTagSet& tagset() { @@ -154,6 +157,9 @@ public: // will instantiate the LogTagSetMapping template, which in turn creates the static field for that // tagset. This _tagset contains the configuration for those tags. template -LogTagSet LogTagSetMapping::_tagset(&LogPrefix::prefix, T0, T1, T2, T3, T4); +LogTagSet LogTagSetMapping::_tagset(&LogPrefix::prefix, T0, T1, T2, T3, T4, &_tagset_4z ); + +template +LogTagSet LogTagSetMapping::_tagset_4z( &LogPrefix::prefix, LogTag::_4z, T0, T1, T2, T3 ); #endif // SHARE_VM_LOGGING_LOGTAGSET_HPP