Page 1 of 1

Logger Output

Posted: Thu Nov 30, 2023 9:13 am
by mcshep
Hi all!

I have been running RRA through the OpenSim Python API on the OpenScienceGrid. When I run the code not through Python not on the OpenScienceGrid, the opensim.log file is autocreated with all of the RRA mass adjustments etc. being outputted in that file. However, for whatever reason the opensim.log file is not being created automatically when running the Python code through the OpenScienceGrid. I am trying to manually create that file using the Logger class. I am now getting a file, but it still does not include the RRA outputs needed. Is there a different way to create this file manually that I am missing?

Thanks!
Molly

Re: Logger Output

Posted: Sun Dec 03, 2023 4:24 am
by kernalnet
Hi, I'm not familiar with OpenScienceGrid and it's not clear from your description how you are implementing Logger. OpenSim automatically creates opensim.log file, but you can still create it manually (be sure to call removeFileSink() first):

Code: Select all

osim.Logger.setLevelString('Info')
osim.Logger.removeFileSink()
osim.Logger.addFileSink('log_file.log')
Also, you can run any setup file using opensim-cmd.exe and save its log file:

Code: Select all

from subprocess import call

with open('log_file.log', 'w') as f:
	call(['opensim-cmd', 'run-tool', 'setup_file.xml')], stdout=f)
Hope this helps,
Mohammadreza

Re: Logger Output

Posted: Mon Dec 04, 2023 12:58 pm
by mcshep
That is exactly what I needed, thank you!!