-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Log dumper #445
Merged
+773
−263
Merged
Feat: Log dumper #445
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
84595e7
Feat[MQB]: Log dumper
bdd36d1
Cleanup comments
waldgange 8479e38
Merge branch 'main' into logdumper
waldgange 527b07f
Update src/groups/mqb/mqbcfg/mqbcfg_messages.cpp
waldgange eb72da3
Address review pt2
waldgange 93c314c
Merge branch 'main' into logdumper
waldgange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,6 +227,20 @@ class LogControllerConfig { | |
CategoryPropertiesMap d_categories; | ||
// Map of category properties | ||
|
||
int d_recordBufferSize; | ||
// Size in bytes of the logger's record buffer | ||
|
||
ball::Severity::Level d_recordingVerbosity; | ||
// If the severity level of the record is at least as severe as the | ||
// d_recordingVerbosity, then the record will be stored by the logger in | ||
// its log record buffer (i.e., it will be recorded). | ||
|
||
ball::Severity::Level d_triggerVerbosity; | ||
// If the severity of the record is at least as severe as the | ||
// d_triggerVerbosity, then the record will cause immediate publication | ||
// of that record and any records in the logger's log record buffer (i.e., | ||
// this record will trigger a log record dump). | ||
|
||
private: | ||
/// Convert specified BALL severity `level` to the corresponding | ||
/// BSLS_LOG severity level. | ||
|
@@ -269,6 +283,7 @@ class LogControllerConfig { | |
LogControllerConfig& setSyslogEnabled(bool value); | ||
LogControllerConfig& setSyslogFormat(const bslstl::StringRef& value); | ||
LogControllerConfig& setSyslogAppName(const bslstl::StringRef& value); | ||
LogControllerConfig& setRecordBufferSize(int value); | ||
|
||
/// Set the corresponding attribute to the specified `value` and return | ||
/// a reference offering modifiable access to this object. | ||
|
@@ -283,16 +298,6 @@ class LogControllerConfig { | |
/// Clear the registered list of category properties. | ||
void clearCategoriesProperties(); | ||
|
||
/// Populate members of this object from the corresponding fields in the | ||
/// specified `datum`. Return 0 on success, or a non-zero return code | ||
/// on error, populating the specified `errorDescription` with a | ||
/// description of the error. Note that in case of error, some of the | ||
/// values from `datum` may have already been applied and so this object | ||
/// might be partially altered. Refer to the component level | ||
/// documentation (section: "LogControllerConfig: Datum format") for the | ||
/// expected format of the `datum`. | ||
int fromDatum(bsl::ostream& errorDescription, const bdld::Datum& datum); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this being deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use it anywhere since 2019. We use 'fromObj()' method to parse the broker config instead |
||
|
||
/// Populate members of this object from the corresponding fields in the | ||
/// specified `obj` (which should be of a type compatible with one | ||
/// generated from a schema as described at the top in the component | ||
|
@@ -316,6 +321,9 @@ class LogControllerConfig { | |
const bsl::string& syslogFormat() const; | ||
const bsl::string& syslogAppName() const; | ||
ball::Severity::Level syslogVerbosity() const; | ||
int recordBufferSize() const; | ||
ball::Severity::Level recordingVerbosity() const; | ||
ball::Severity::Level triggerVerbosity() const; | ||
|
||
/// Return the value of the corresponding attribute. | ||
const CategoryPropertiesMap& categoriesProperties() const; | ||
|
@@ -456,11 +464,18 @@ class LogController { | |
/// will no longer be available. | ||
void shutdown(); | ||
|
||
/// Change the logging severity threshold to the specified `verbosity`: | ||
/// any record with a severity of at least `verbosity` will be printed | ||
/// to the log file, and eventually to the console if the configured | ||
/// console severity threshold allows it. | ||
void setVerbosityLevel(ball::Severity::Level verbosity); | ||
/// Change the logging severity threshold to the specified verbosity | ||
/// levels: any record with a severity of at least `passVerbosity` will | ||
/// be printed immediately to the log file, and eventually to the | ||
/// console if the configured console severity threshold allows it. | ||
/// any record with a severity of at least `recordingVerbosity` will be | ||
/// stored by the logger in its log record buffer. Any record with a | ||
/// severity of at least `triggerVerbosity` will cause immediate | ||
/// publication of that record and any records in the logger's buffer. | ||
void setVerbosityLevel( | ||
ball::Severity::Level passVerbosity, | ||
ball::Severity::Level recordVerbosity = ball::Severity::OFF, | ||
ball::Severity::Level triggerVerbosity = ball::Severity::OFF); | ||
|
||
/// Change the verbosity of the specified `category` to the specified | ||
/// `verbosity`. `category` can be an expression, with a terminating | ||
|
@@ -512,7 +527,8 @@ int LogControllerConfig::fromObj(bsl::ostream& errorDescription, | |
.setConsoleFormat(obj.consoleFormat()) | ||
.setSyslogEnabled(obj.syslog().enabled()) | ||
.setSyslogAppName(obj.syslog().appName()) | ||
.setSyslogFormat(obj.syslog().logFormat()); | ||
.setSyslogFormat(obj.syslog().logFormat()) | ||
.setRecordBufferSize(32768); | ||
|
||
if (ball::SeverityUtil::fromAsciiCaseless( | ||
&d_loggingVerbosity, | ||
|
@@ -522,6 +538,9 @@ int LogControllerConfig::fromObj(bsl::ostream& errorDescription, | |
return -1; // RETURN | ||
} | ||
|
||
d_recordingVerbosity = ball::Severity::OFF; | ||
d_triggerVerbosity = ball::Severity::OFF; | ||
|
||
ball::Severity::Level bslsSeverityAsBal = ball::Severity::e_ERROR; | ||
// TODO: enforcing 'obj' to have 'bslsLogSeverityThreshold' accessor is a | ||
// backward incompatible change from build perspective, and will require a | ||
|
@@ -651,6 +670,12 @@ LogControllerConfig::setSyslogAppName(const bslstl::StringRef& value) | |
return *this; | ||
} | ||
|
||
inline LogControllerConfig& LogControllerConfig::setRecordBufferSize(int value) | ||
{ | ||
d_recordBufferSize = value; | ||
return *this; | ||
} | ||
|
||
inline LogControllerConfig& | ||
LogControllerConfig::setSyslogVerbosity(ball::Severity::Level value) | ||
{ | ||
|
@@ -725,6 +750,21 @@ inline ball::Severity::Level LogControllerConfig::syslogVerbosity() const | |
return d_syslogVerbosity; | ||
} | ||
|
||
inline int LogControllerConfig::recordBufferSize() const | ||
{ | ||
return d_recordBufferSize; | ||
} | ||
|
||
inline ball::Severity::Level LogControllerConfig::recordingVerbosity() const | ||
{ | ||
return d_recordingVerbosity; | ||
} | ||
|
||
inline ball::Severity::Level LogControllerConfig::triggerVerbosity() const | ||
{ | ||
return d_triggerVerbosity; | ||
} | ||
|
||
inline const LogControllerConfig::CategoryPropertiesMap& | ||
LogControllerConfig::categoriesProperties() const | ||
{ | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this number come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default
recordBufferSize
of theball::LoggerManagerConfiguration
component we use to dump logs. We used to set it hereblazingmq/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.cpp
Line 654 in b390620
Now it's a variable. We are going to retrieve this number from the config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this number in bytes? Can we just quickly mark the unit for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I've renamed the variable and added a comment in the same style as the variables above.