ROOT logo
AliRoot » STEER » STEERBASE » AliLog

class AliLog: public TObject


class for logging debug, info and error messages

The AliLog class is a singleton class. It allows to steer the output
level and output streams for different types of messages via static
methods.

It also handles the messages produces by the preprocessor macros defined
in the header file: AliDebug, AliInfo, AliWarning, AliError, AliFatal.

More details about the message logging can be found on the ALICE Offline
web page.


Function Members (Methods)

public:
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
static voidClearClassDebugLevel(const char* className)
static voidClearModuleDebugLevel(const char* module)
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
static voidDebug(UInt_t level, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
virtual voidTObject::Delete(Option_t* option = "")MENU
static voidDeleteRootLogger()
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
static voidEnableCoreDump(Bool_t enabled)
static voidEnableDebug(Bool_t enabled)
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
static voidFlush()
static Int_tGetDebugLevel(const char* module, const char* className)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
static Int_tGetGlobalDebugLevel()
static Int_tGetGlobalLogLevel()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
static AliLog*GetRootLogger()
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
static Bool_tIsDebugEnabled()
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
static voidMakeCoreDump(const char* fout)
voidTObject::MayNotUse(const char* method) const
static voidMessage(UInt_t level, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
static Int_tRedirectStderrTo(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
static Int_tRedirectStdoutTo(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
voidTObject::ResetBit(UInt_t f)
static voidRestoreStderr(Int_t original)
static voidRestoreStdout(Int_t original)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
static voidSetClassDebugLevel(const char* className, Int_t level)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidSetErrorOutput()
static voidSetErrorOutput(AliLog::EType_t type)
static voidSetFileOutput(const char* fileName)
static voidSetFileOutput(AliLog::EType_t type, const char* fileName)
static voidSetGlobalDebugLevel(Int_t level)
static voidSetGlobalLogLevel(AliLog::EType_t type)
static voidSetHandleRootMessages(Bool_t on)
static voidSetLogNotification(AliLog::AliLogNotification pCallBack)
static voidSetLogNotification(AliLog::EType_t type, AliLog::AliLogNotification pCallBack)
static voidSetModuleDebugLevel(const char* module, Int_t level)
static voidTObject::SetObjectStat(Bool_t stat)
static voidSetPrintLocation(Bool_t on)
static voidSetPrintLocation(AliLog::EType_t type, Bool_t on)
static voidSetPrintModule(Bool_t on)
static voidSetPrintModule(AliLog::EType_t type, Bool_t on)
static voidSetPrintRepetitions(Bool_t on)
static voidSetPrintScope(Bool_t on)
static voidSetPrintScope(AliLog::EType_t type, Bool_t on)
static voidSetPrintType(Bool_t on)
static voidSetPrintType(AliLog::EType_t type, Bool_t on)
static voidSetStandardOutput()
static voidSetStandardOutput(AliLog::EType_t type)
static voidSetStreamOutput(ostream* stream)
static voidSetStreamOutput(AliLog::EType_t type, ostream* stream)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector&)
static ostream&Stream(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
static voidTestException(Int_t level = 10)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
static voidWriteToFile(const char* name, Int_t option = 0)
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
AliLog()
AliLog(const AliLog& log)
(unknown)()
voidCloseFile(Int_t type)
UInt_tGetLogLevel(const char* module, const char* className) const
FILE*GetOutputStream(Int_t type)
ostream&GetStream(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line)
AliLog&operator=(const AliLog& log)
voidPrintMessage(UInt_t type, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
voidPrintRepetitions()
voidPrintString(Int_t type, FILE* stream, const char* format)
voidReadEnvSettings()
Int_tRedirectTo(FILE* stream, AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
static voidRootErrorHandler(Int_t level, Bool_t abort, const char* location, const char* message)

Data Members

public:
enum EType_t { kFatal
kError
kWarning
kInfo
kDebug
kMaxType
};
enum { kDebugOffset
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
private:
void*fCallBacks[5]! external notification callback
TObjArrayfClassDebugLevelsdebug levels for classes
TStringfFileNames[5]file names
UInt_tfGlobalLogLevelglobal logging level
TStringfLastClassName! class name of last message
TStringfLastFile! file name of last message
TStringfLastFunction! function name of last message
Int_tfLastLine! line number of last message
TStringfLastMessage! last message
TStringfLastModule! module name of last message
UInt_tfLastType! type of last message
TObjArrayfModuleDebugLevelsdebug levels for modules
FILE*fOutputFiles[5]! log output files
ostream*fOutputStreams[5]! log output streams
Int_tfOutputTypes[5]types of output streams
Bool_tfPrintLocation[5]print file and line on/off
Bool_tfPrintModule[5]print module on/off
Bool_tfPrintRepetitionsprint number of repetitions instead of repeated message on/off
Bool_tfPrintScope[5]print scope/class name on/off
Bool_tfPrintType[5]print type on/off
Int_tfRepetitions! counter of repetitions
static Bool_tfgCoreEnabledflag for core dump en-/disabling
static Bool_tfgDebugEnabledflag for debug en-/disabling
static AliLog*fgInstance! pointer to current instance

Class Charts

Inheritance Chart:
TObject
AliLog

Function documentation

AliLog * GetRootLogger()
void DeleteRootLogger()
AliLog()
 default constructor: set default values
AliLog(const AliLog& log)
 copy constructor
void ReadEnvSettings()
 load settings from the root configuration file (.rootrc)
 and from environment variables
void RootErrorHandler(Int_t level, Bool_t abort, const char* location, const char* message)
 new error handler for messages from root
void EnableDebug(Bool_t enabled)
 enable or disable debug output
void EnableCoreDump(Bool_t enabled)
 enable or disable debug output
void SetGlobalLogLevel(AliLog::EType_t type)
 set the global debug level
Int_t GetGlobalLogLevel()
 get the global debug level
void SetGlobalDebugLevel(Int_t level)
 set the global debug level
Int_t GetGlobalDebugLevel()
 get the global debug level
void SetModuleDebugLevel(const char* module, Int_t level)
 set the debug level for the given module
void ClearModuleDebugLevel(const char* module)
 remove the setting of the debug level for the given module
void SetClassDebugLevel(const char* className, Int_t level)
 set the debug level for the given class
void ClearClassDebugLevel(const char* className)
 remove the setting of the debug level for the given class
void SetStandardOutput()
 write all log messages to the standard output (stdout)
void SetStandardOutput(AliLog::EType_t type)
 write log messages of the given type to the standard output (stdout)
void SetErrorOutput()
 write all log messages to the error output (stderr)
void SetErrorOutput(AliLog::EType_t type)
 write log messages of the given type to the error output (stderr)
void SetFileOutput(const char* fileName)
 write all log messages to the given file
void SetFileOutput(AliLog::EType_t type, const char* fileName)
 write log messages of the given type to the given file
void CloseFile(Int_t type)
 close the file for the given type if needed
FILE* GetOutputStream(Int_t type)
 get the output stream for the given type of messages
void Flush()
 flush the output streams
void SetHandleRootMessages(Bool_t on)
 enable or disable the handling of messages form root
void SetPrintType(Bool_t on)
 switch on or off the printing of the message type for all message types
void SetPrintType(AliLog::EType_t type, Bool_t on)
 switch on or off the printing of the message type for the given message type
void SetPrintModule(Bool_t on)
 switch on or off the printing of the module for all message types
void SetPrintModule(AliLog::EType_t type, Bool_t on)
 switch on or off the printing of the module for the given message type
void SetPrintScope(Bool_t on)
 switch on or off the printing of the scope/class name for all message types
void SetPrintScope(AliLog::EType_t type, Bool_t on)
 switch on or off the printing of the scope/class name
 for the given message type
void SetPrintLocation(Bool_t on)
 switch on or off the printing of the file name and line number
 for all message types
void SetPrintLocation(AliLog::EType_t type, Bool_t on)
 switch on or off the printing of the file name and line number
 for the given message type
void SetPrintRepetitions(Bool_t on)
 switch on or off the printing of the number of repetitions of a message
 instead of repeating the same message
void WriteToFile(const char* name, Int_t option = 0)
 write the log object with the given name and option to the current file
UInt_t GetLogLevel(const char* module, const char* className) const
 get the logging level for the given module and class
Int_t GetDebugLevel(const char* module, const char* className)
 get the debug level for the given module and class
void PrintMessage(UInt_t type, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
 print the given message
void PrintRepetitions()
 print number of repetitions
void Message(UInt_t level, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
 print a log message
void Debug(UInt_t level, const char* message, const char* module, const char* className, const char* function, const char* file, Int_t line)
 print a debug message
Int_t RedirectStdoutTo(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
 redirect the standard output to the stream of the given type
Int_t RedirectStderrTo(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
 redirect the standard error output to the stream of the given type
Int_t RedirectTo(FILE* stream, AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line, Bool_t print)
 redirect the standard (error) output stream to the stream of the given type
void RestoreStdout(Int_t original)
 restore the standard output
void RestoreStderr(Int_t original)
 restore the standard error output
ostream& Stream(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line)
 get the stream object for the given output type
ostream& GetStream(AliLog::EType_t type, UInt_t level, const char* module, const char* className, const char* function, const char* file, Int_t line)
 get the stream object for the given output type
void SetStreamOutput(ostream* stream)
 set an external stream as target for log messages of all types
 the external stream is completely handled by the caller, the
 AliLog class just writes to it
void SetStreamOutput(AliLog::EType_t type, ostream* stream)
 set an external stream as target for log messages of the given type
 the external stream is completely handled by the caller, the
 AliLog class just writes to it
void SetLogNotification(AliLog::AliLogNotification pCallBack)
 set a notification callback function for log messages of all types
void SetLogNotification(AliLog::EType_t type, AliLog::AliLogNotification pCallBack)
 set a notifications call back function for log messages of all types
 the callback fuction is invoced whenever an output was written
 Note: does not work for c++ streamer classes, the external stream
 has to handle this diectly (e.g. custom implementation of endl)
void PrintString(Int_t type, FILE* stream, const char* format, ...)
 this is the general method to print a log message using variadac args
 to the FILE* like (C - like) streams, e.g. stdout, stderr, or files
 opened by fopen.
 Only in case of an external c++ ostream type output, the message is
 written to that stream and the notifictaion callback is called.
 The message is printed by a normal vfprintf function otherwise
void MakeCoreDump(const char* fout)
 Functionality to make a program snapshot
   gcore - Generate a core file for a running process
   gcore dmake a current snapshot, program can continue further
   We assum that gcore is installed
   for details see:  man gcore

 Example use - make default core file for current process:  AliLog::MakeCoreDump(0)


 Automatic core dump creation in case of the AliFatal can be specified using
 static void  EnableCoreDump(Bool_t enabled);
 Core dump is created in addition to the stack trace ()
 marian.ivanov@cern.ch

void TestException(Int_t level = 10)
 Dummy function to throw exception

Bool_t IsDebugEnabled()
 the following public methods are used by the preprocessor macros
 and should not be called directly
{return fgDebugEnabled;}