Message: trying to direct G4cout into a log file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question trying to direct G4cout into a log file 

Forum: Documentation and Examples
Date: 20 Jul, 2016
From: Michael Kuss <Michael Kuss>

Hi,

I'm kind of new to geant4 (new again), at least I'm trying to do things I haven't done before.

I followed the lines of section 7.2.4. to redirect G4cout/cerr into a file.

My UIsession:

 std::ofstream fLogFile("test.log");

RedUIsession::RedUIsession() {}

RedUIsession::~RedUIsession() {}

G4int RedUIsession::ReceiveG4cout(const G4String& coutString) {
    fLogFile << coutString << std::flush;
    return 0;
}

G4int RedUIsession::ReceiveG4cerr(const G4String& cerrString) {
    fLogFile << cerrString << std::flush;
    return 0;
}

and in main():

  RedUIsession* UIsession = new RedUIsession;
  UImanager->SetCoutDestination(UIsession);

However, the only output which ends up in test.log is:

Available UI session types: [ Qt, GAG, tcsh, csh ]

Nothing else, the rest is still in the GUI log screen. What do I do wrong?

Thanks,

Michael

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: trying to direct G4cout into a log file   (Ivana Hrivnacova - 20 Jul, 2016)
(_ None: Re: trying to direct G4cout into a log file   (Michael Kuss - 21 Jul, 2016)
 Add Message Add Message
to: "trying to direct G4cout into a log file"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]