-
Notifications
You must be signed in to change notification settings - Fork 164
[QC-871] Add log rotate parameters and refactor how we pass the discard file options #1488
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
Changes from all commits
c1945e3
6c44a04
3483991
06492fb
1439fa5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ void QcInfoLogger::setPartition(const std::string& partitionName) | |
| } | ||
|
|
||
| void QcInfoLogger::init(const std::string& facility, | ||
| bool discardDebug, | ||
| int discardFromLevel, | ||
| const std::string& discardToFile, | ||
| const DiscardFileParameters& discardFileParameters, | ||
| AliceO2::InfoLogger::InfoLogger* dplInfoLogger, | ||
| AliceO2::InfoLogger::InfoLoggerContext* dplContext, | ||
| int run, | ||
|
|
@@ -75,15 +73,16 @@ void QcInfoLogger::init(const std::string& facility, | |
| } | ||
|
|
||
| // Set the proper discard filters | ||
| ILOG_INST.filterDiscardDebug(discardDebug); | ||
| ILOG_INST.filterDiscardLevel(discardFromLevel); | ||
| if (!discardToFile.empty()) { | ||
| ILOG_INST.filterDiscardSetFile(discardToFile.c_str(), 1000000000, 10, 0, true /*Do not store Debug messages in file*/); | ||
| ILOG_INST.filterDiscardDebug(discardFileParameters.debug); | ||
| ILOG_INST.filterDiscardLevel(discardFileParameters.fromLevel); | ||
| if (!discardFileParameters.discardFile.empty()) { | ||
| ILOG_INST.filterDiscardSetFile(discardFileParameters.discardFile.c_str(), discardFileParameters.rotateMaxBytes, discardFileParameters.rotateMaxFiles, true /*Do not store Debug messages in file*/); | ||
| } | ||
| ILOG(Debug, Ops) << "QC infologger initialized" << ENDM; | ||
| ILOG(Debug, Support) << " Discard debug ? " << discardDebug << ENDM; | ||
| ILOG(Debug, Support) << " Discard from level ? " << discardFromLevel << ENDM; | ||
| ILOG(Debug, Support) << " Discard to file ? " << (!discardToFile.empty() ? discardToFile : "No") << ENDM; | ||
| ILOG(Debug, Support) << " Discard debug ? " << discardFileParameters.debug << ENDM; | ||
| ILOG(Debug, Support) << " Discard from level ? " << discardFileParameters.fromLevel << ENDM; | ||
| ILOG(Debug, Support) << " Discard to file ? " << (!discardFileParameters.discardFile.empty() ? discardFileParameters.discardFile : "No") << ENDM; | ||
| ILOG(Debug, Support) << " Discard max bytes and files ? " << discardFileParameters.rotateMaxBytes << " = " << discardFileParameters.rotateMaxFiles << ENDM; | ||
|
|
||
| setFacility(facility); | ||
| setRun(run); | ||
|
|
@@ -97,11 +96,12 @@ void QcInfoLogger::init(const std::string& facility, | |
| int run, | ||
| const std::string& partitionName) | ||
| { | ||
| DiscardFileParameters discardFileParameters; | ||
| std::string discardDebugStr = config.get<std::string>("qc.config.infologger.filterDiscardDebug", "false"); | ||
| bool discardDebug = discardDebugStr == "true"; | ||
| int discardLevel = config.get<int>("qc.config.infologger.filterDiscardLevel", 21 /* Discard Trace */); | ||
| std::string discardToFile = config.get<std::string>("qc.config.infologger.filterDiscardFile", ""); | ||
| init(facility, discardDebug, discardLevel, discardToFile, dplInfoLogger, dplContext, run, partitionName); | ||
| discardFileParameters.debug = discardDebugStr == "true"; | ||
| discardFileParameters.fromLevel = config.get<int>("qc.config.infologger.filterDiscardLevel", 21 /* Discard Trace */); | ||
| discardFileParameters.discardFile = config.get<std::string>("qc.config.infologger.filterDiscardFile", ""); | ||
| init(facility, discardFileParameters, dplInfoLogger, dplContext, run, partitionName); | ||
|
Comment on lines
+101
to
+104
Collaborator
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 are you not reloading all the parameters?
Collaborator
Author
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. good point, will fix. |
||
| } | ||
|
|
||
| } // namespace o2::quality_control::core | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -935,8 +935,10 @@ should not be present in real configuration files. | |
| "filterDiscardDebug": "false", "": "Set to 1 to discard debug and trace messages (default: false)", | ||
| "filterDiscardLevel": "2", "": "Message at this level or above are discarded (default: 21 - Trace)", | ||
| "filterDiscardFile": "", "": ["If set, the discarded messages will go to this file (default: <none>)", | ||
| "The keyword _ID_, if used, is replaced by the device ID.", | ||
| "Discarded Debug messages don't go there."] | ||
| "The keyword _ID_, if used, is replaced by the device ID.", | ||
| "Discarded Debug messages don't go there."], | ||
| "filterRotateMaxBytes": "", "": "Maximum size of the discard file.", | ||
| "filterRotateMaxFiles": "", "": "Maximum number of discard files." | ||
|
Collaborator
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 there could be more than one?
Collaborator
Author
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. isn't that how logrotate usually works ? when a file is full it creates a new one, within the limit of the number of files ?
Collaborator
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. ah yes, of course |
||
| }, | ||
| "postprocessing": { "": "Configuration parameters for post-processing", | ||
| "periodSeconds": 10.0, "": "Sets the interval of checking all the triggers. One can put a very small value", | ||
|
|
||
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.
as a future improvement, I would propose to move this structure to a separate file, so we do not include QcInfologger header in configuration structures.
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.
agreed, will do