Possible to store a log file in a root file?

Here I am wondering if there is a possible way to save a log file (a text file, whatever information it encloses.) in a root file. As you know, when we create a root file, we may have different conditions or log informations, of course, I could print these log-like infomation into a separate text file for my late reference. However, if I can open a log file stored in a root file, it will be convenient so much that I don’t need to remember which log file is accosiated with this root. And I think it is an outstanding feature for all rooters.

Also, I may do this job by creating a canvas and print info on the canvas. If I have too much information and so many lines, I cannot handle.

Looking forwad to your ideas!


you could use a TMacro, see root.cern.ch/root/html/TMacro - but don’t try to execute your log file :wink:

Thanks, Axel.

Acturally this way by TMacro is still not so convenient. I mean, although I can store my log file as a macro, I cannot click it to see its content right away, and if tons of log infomation, I can page down and up.


Did you try? It should work, e.g. in a TBrowser. Could you clarify what you’re doing exactly, i.e. where you cannot click it?


Yes, I tried. I use the following simple code to do that.

TFile *outputfile = new TFile("testTMacro.root", "CREATE"); TMacro * m = new TMacro("logfile", "store log information"); for (int i =0; i <1000>AddLine("I am one line of TMacro!!!"); m->Write(); }
then open the outputfile to TBrowser. logfile i s over there. I have no idea how to see its content.