Redirecting stdout/stderr

A forum dedicated to feature requests and the future direction of OpenSees, i.e. what would you like, what do you need, what should we explore

Moderators: silvia, selimgunay, Moderators

Post Reply
anema
Posts: 4
Joined: Wed Feb 15, 2012 11:51 am
Location: UCSD

Redirecting stdout/stderr

Post by anema » Mon Aug 17, 2015 2:05 pm

Hi Frank,
In version 2.4.0 of opensees, I am able to close the standard output and standard error and redirect them into separate files. In version 2.4.6 it does not work correctly, all output seems to go to the standard error channel. Can this behavior be reverted to the original behavior? I think the change was introduced in revision 5532. The following code snippet is what I use to redirect the output:
[code]
close stdout
set foutID [open $dataDir/output.out w+]
fconfigure $foutID -buffering none

#set stderrID [dup stderr]
close stderr
set ferrID [open $dataDir/output.err w+]
fconfigure $ferrID -buffering none
[/code]

The dup command, if it works (an extra tcl package is needed to my understanding), is to show the output to the screen and record into the file.
Thanks
AN

PS. How can I enable BBCode in the posts?

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Redirecting stdout/stderr

Post by fmk » Wed Aug 19, 2015 10:02 am

the problem with differntiating between stderr and stdout was that the opensees classes need to send everything to stderr, even when there was no error. when i had the puts go to stdout and everything going to stderr I had complaints. Ultimately we need to provide the classes with an opserr and opsout that they can use to dfferentiate between the two.

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Redirecting stdout/stderr

Post by fmk » Wed Aug 19, 2015 10:04 am

as it is only puts that would go to stdout .. you could do what you were doing before by adding the fileID to the puts command

Post Reply