I am trying to debug some rare tracking issues in my multithreaded application. I’ve turned on /tracking/verbose 1
, but of course the output is close to useless:
G4WT12 > 26 -1.22e+03 981 1.16e+03 0.222 0 321 1.86e+03 Shield/RadonBarrier CoupledTransportation
G4WT5 > 16 -139 538 -482 0.231 0 15.3 315 BareDetector CoupledTransportation
G4WT19 > 20 -852 348 -214 0.222 0 10.1 625 Detector CoupledTransportation
G4WT19 > 21 -887 351 -219 0.222 0 34.7 660 Shield/MuMetalShield CoupledTransportation
G4WT2 > 23 260 146 -634 0.222 0 6.32 649 BareDetector CoupledTransportation
G4WT16 > 17 276 17.9 -602 0.222 0 6.62 536 BareDetector CoupledTransportation
G4WT13 > 22 343 470 -851 0.222 0 48.6 763 Detector CoupledTransportation
G4WT7 > 25 -315 -1.53e+03 -988 0.222 0 214 1.95e+03
Using grep
to filter on the thread prefix is not useful, since the errors (G4Exception) I’m trying to fix are multiline output, and the lines don’t have the thread prefix.
What I’d like to do is redirect each thread’s output to a separate log file. The existing commands /control/cout/setCoutFile
and /control/cout/setCerrFile
are global, and have no provision for including the thread index in the filename.
There is no command (I’d expect it under /run
) to access the worker thread index; with that, I’d be able to patch together an ugly chain of UI aliases to define thread-by-thread names.
Is there an easy way, in a macro file, to get separate log files for each thread?