edickie / ciftify

The tools of the Human Connectome Project (HCP) adapted for working with non-HCP datasets
https://edickie.github.io/ciftify/
MIT License
111 stars 156 forks source link

utilities run command not setting the right log level... #24

Closed edickie closed 6 years ago

edickie commented 6 years ago

The ciftify_recon_all.log ciftify_subject_fmri.log files aren't don't contain the "Running: cmd" sections..

They do contains the section headers, which are also at the info level...and error messages... so maybe the run function is internally resetting the log level??

edickie commented 6 years ago

added a hack fix to this by making a little function to call the run function. This is because I wanted to 1) explicitly pass the logger stream in 2) explicitly pass the DRYRUN argument from the DRYRUN global variable

Also I added a setting we're the whole script dies when the subprocess exits with an error...maybe this should be a default for the run function itself??

DESm1th commented 6 years ago

Hey Erin,

I've finally got a working recipe for this.

First: logger needs to be set to be the logger for the whole package, not just the current script. This will let it capture logging from utilities and other scripts. So:

logger = logging.getLogger('ciftify')

Second: The logger needs to have it's log level set to be the 'highest' level. That is, it needs to be the level that catches the most logging output (debug in our case since we dont use any more verbose levels). So:

logger.setlevel(logging.DEBUG)

Third: From that point on, only modify the log level of specific handlers. So the stream handler can be changed to lower levels, but other handlers can still receive the debug log messages for the entire package.

I've fixed this in pull request #25

I also removed the logging argument from run, since it doesnt need to be passed around now.

edickie commented 6 years ago

done..thanks Dawn