From: richterm Date: Mon, 24 Nov 2008 17:53:09 +0000 (+0000) Subject: updated logging concept X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=6610841776bdbce16d581f265894cb75bd2b8664;p=u%2Fmrichter%2FAliRoot.git updated logging concept - global method to set the local logging default - updated documentation - logging key for components set from chain id local --- diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 1092652194a..0daf1c7e81c 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -153,7 +153,7 @@ int AliHLTComponent::UnsetGlobalComponentHandler() int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environParam, int argc, const char** argv ) { // see header file for function documentation - HLTLogKeyword(GetComponentID()); + HLTLogKeyword(fChainId.c_str()); int iResult=0; if (comenv) { memset(&fEnvironment, 0, sizeof(AliHLTAnalysisEnvironment)); @@ -176,12 +176,11 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ if (argument.IsNull()) continue; // benchmark - if (argument.CompareTo("benchmark")==0) { + if (argument.CompareTo("-benchmark")==0) { - // loglevel - } else if (argument.CompareTo("loglevel")==0) { - if ((bMissingParam=(++i>=argc))) break; - TString parameter(argv[i]); + // -loglevel= + } else if (argument.BeginsWith("-loglevel=")) { + TString parameter=argument.ReplaceAll("-loglevel=", ""); parameter.Remove(TString::kLeading, ' '); // remove all blanks if (parameter.BeginsWith("0x") && parameter.Replace(0,2,"",0).IsHex()) { @@ -252,7 +251,7 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ int AliHLTComponent::Deinit() { // see header file for function documentation - HLTLogKeyword(GetComponentID()); + HLTLogKeyword(fChainId.c_str()); int iResult=0; iResult=DoDeinit(); if (fpRunDesc) { @@ -1388,7 +1387,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData, AliHLTComponentEventDoneData*& edd ) { // see header file for function documentation - HLTLogKeyword(GetComponentID()); + HLTLogKeyword(fChainId.c_str()); ALIHLTCOMPONENT_BASE_STOPWATCH(); int iResult=0; fCurrentEvent=evtData.fEventID; diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index c9d29a6a73a..b00828c72fc 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -282,6 +282,7 @@ typedef vector AliHLTMemoryFilePList; * @section alihlt_component_arguments Default arguments * The component base class provides some default arguments: * + * \li -loglevel=level
* \li -object-compression=level
* compression level for ROOT objects, default is defined by * @ref ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION diff --git a/HLT/BASE/AliHLTLogging.cxx b/HLT/BASE/AliHLTLogging.cxx index 6e687c00ae2..1f23458de9d 100644 --- a/HLT/BASE/AliHLTLogging.cxx +++ b/HLT/BASE/AliHLTLogging.cxx @@ -40,8 +40,7 @@ ClassImp(AliHLTLogging); AliHLTLogging::AliHLTLogging() : - //fLocalLogFilter(kHLTLogDefault), - fLocalLogFilter(kHLTLogAll), + fLocalLogFilter(fgLocalLogDefault), fpDefaultKeyword(NULL), fpCurrentKeyword(NULL) { @@ -71,6 +70,7 @@ AliHLTLogging& AliHLTLogging::operator=(const AliHLTLogging&) ostringstream AliHLTLogging::fgLogstr; AliHLTComponentLogSeverity AliHLTLogging::fgGlobalLogFilter=kHLTLogAll; +AliHLTComponentLogSeverity AliHLTLogging::fgLocalLogDefault=kHLTLogAll; AliHLTfctLogging AliHLTLogging::fgLoggingFunc=NULL; AliHLTLogging::AliHLTDynamicMessage AliHLTLogging::fgAliLoggingFunc=NULL; int AliHLTLogging::fgUseAliLog=1; @@ -418,6 +418,12 @@ AliHLTComponentLogSeverity AliHLTLogging::GetLocalLoggingLevel() return fLocalLogFilter; } +void AliHLTLogging::SetLocalLoggingDefault(AliHLTComponentLogSeverity level) +{ + // see header file for class documentation + fgLocalLogDefault=level; +} + int AliHLTLogging::CheckGroup(const char* /*originClass*/) const { // see header file for class documentation diff --git a/HLT/BASE/AliHLTLogging.h b/HLT/BASE/AliHLTLogging.h index 344e0f05b75..a6f25c529a7 100644 --- a/HLT/BASE/AliHLTLogging.h +++ b/HLT/BASE/AliHLTLogging.h @@ -54,6 +54,48 @@ class AliHLTComponentHandler; #define HLT_DEFAULT_LOG_KEYWORD "no key" +/** + * @class AliHLTLogging + * Basic logging class. All classes inherit the besic HLT logging functionality. + * Logging levels are controlled by a global logging filter and a local logging + * filter. + * + * @section alihlt_logging_levels Logging Levels + * Logging levels are switched by a bit pattern, AliHLTComponentLogSeverity { + * - ::kHLTLogNone no logging (0) + * - ::kHLTLogBenchmark benchmark messages (0x1) + * - ::kHLTLogDebug debug messages (0x2) + * - ::kHLTLogInfo info messages (0x4) + * - ::kHLTLogWarning warning messages (0x8) + * - ::kHLTLogError error messages (0x10) + * - ::kHLTLogFatal fatal error messages (0x20) + * - ::kHLTLogImportant few important messages not to be filtered out (0x40) + * - ::kHLTLogAll special value to enable all messages (0x7f) + * - ::kHLTLogDefault the default logging level: Warning, Error, Fatal, Important (0x79) + * + * @section alihlt_logging_filter Logging Filters + * The class provides a global and a local logging filter, the AND beween both + * defines whether a message is printed or not. + * + * The global filter is by default set to ::kHLTLogAll. Please note that AliHLTSystem + * changes the global logging level to ::kHLTLogDefault. The global filter can be + * adjusted by means of SetGlobalLoggingLevel(). + * + * The local filter is set to ::kHLTLogAll and can be adjusted by + * SetLocalLoggingLevel(). The default can be changed for all objects by + * SetLocalLoggingDefault(). Please note that a change of the default level only + * applies to objects generated after the change of the default. + * + * @section alihlt_logging_external Redirection + * - external logging function + * - keyword + * + * @section alihlt_logging_aliroot AliRoot Redirection + * - switching of redirection + * - logging options in AliSimulation/AliReconstruction + * + * @ingroup alihlt_component + */ class AliHLTLogging { public: AliHLTLogging(); @@ -178,6 +220,12 @@ public: */ virtual void SetLocalLoggingLevel(AliHLTComponentLogSeverity level); + /** + * Set local logging default + * Default logging filter for individual objects. + */ + static void SetLocalLoggingDefault(AliHLTComponentLogSeverity level); + /** * Get local logging level * logging filter for individual object @@ -249,6 +297,8 @@ private: static AliHLTComponentLogSeverity fgGlobalLogFilter; // see above /** the local logging filter for one class */ AliHLTComponentLogSeverity fLocalLogFilter; // see above + /** the global logging filter */ + static AliHLTComponentLogSeverity fgLocalLogDefault; // see above /** logging callback from the framework */ static AliHLTfctLogging fgLoggingFunc; // see above /** default keyword */