Logger Output

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Molly Shepherd
Posts: 17
Joined: Thu Nov 14, 2019 9:36 am

Logger Output

Post by Molly Shepherd » Thu Nov 30, 2023 9:13 am

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

User avatar
Mohammadreza Rezaie
Posts: 393
Joined: Fri Nov 24, 2017 12:48 am

Re: Logger Output

Post by Mohammadreza Rezaie » Sun Dec 03, 2023 4:24 am

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

User avatar
Molly Shepherd
Posts: 17
Joined: Thu Nov 14, 2019 9:36 am

Re: Logger Output

Post by Molly Shepherd » Mon Dec 04, 2023 12:58 pm

That is exactly what I needed, thank you!!

POST REPLY