diff --git a/src/DIRAC/FrameworkSystem/private/standardLogging/Logging.py b/src/DIRAC/FrameworkSystem/private/standardLogging/Logging.py index b8bd3e0b989..71ea6002866 100644 --- a/src/DIRAC/FrameworkSystem/private/standardLogging/Logging.py +++ b/src/DIRAC/FrameworkSystem/private/standardLogging/Logging.py @@ -383,37 +383,31 @@ def _createLogRecord( :return: boolean representing the result of the log record creation """ + # exc_info is only for exception to add the stack trace + + # extra is a way to add extra attributes to the log record: + # - 'componentname': the system/component name + # - 'varmessage': the variable message + # - 'customname' : the name of the logger for the DIRAC usage: without 'root' and separated with '/' + # as log records, extras attributes are not camel case + extra = { + "componentname": self._componentName, + "varmessage": str(sVarMsg), + "spacer": "" if not sVarMsg else " ", + "customname": self._customName, + } - # lock to prevent a level change after that the log is sent. - self._lockLevel.acquire() - try: - # exc_info is only for exception to add the stack trace - - # extra is a way to add extra attributes to the log record: - # - 'componentname': the system/component name - # - 'varmessage': the variable message - # - 'customname' : the name of the logger for the DIRAC usage: without 'root' and separated with '/' - # as log records, extras attributes are not camel case - extra = { - "componentname": self._componentName, - "varmessage": str(sVarMsg), - "spacer": "" if not sVarMsg else " ", - "customname": self._customName, - } - - # options such as headers and threadIDs also depend on the logger, we have to add them to extra - extra.update(self._options) + # options such as headers and threadIDs also depend on the logger, we have to add them to extra + extra.update(self._options) - # This typically contains local custom names - if local_context: - extra.update(local_context) + # This typically contains local custom names + if local_context: + extra.update(local_context) - self._logger.log(level, "%s", sMsg, exc_info=exc_info, extra=extra) - # check whether the message is displayed - isSent = LogLevels.getLevelValue(self.getLevel()) <= level - return isSent - finally: - self._lockLevel.release() + self._logger.log(level, "%s", sMsg, exc_info=exc_info, extra=extra) + # check whether the message is displayed + isSent = LogLevels.getLevelValue(self.getLevel()) <= level + return isSent def showStack(self) -> bool: """