-
Notifications
You must be signed in to change notification settings - Fork 17
Write an additional log file in PROCESS working directory #4035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Write an additional log file in PROCESS working directory #4035
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4035 +/- ##
==========================================
- Coverage 46.30% 45.84% -0.46%
==========================================
Files 123 123
Lines 28961 29385 +424
==========================================
+ Hits 13411 13473 +62
- Misses 15550 15912 +362 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking about what I said yesterday I agree with this change.
I think it would also be good to change the default file handler to append mode so you don't overwrite the log file.
change L727 to:
logging_file_handler = logging.FileHandler("process.log", mode="a")
alternatively you could rotate the logs somehow but that is more complex and possibly overkill (You could do a symlink process.log to a timed and dated filename)
process/main.py
Outdated
| # Store namespace object of the args | ||
|
|
||
| wkdir_path_length = len(self.args.input.lower().replace("in.dat", "")) | ||
| setup_loggers(Path(self.args.input[:wkdir_path_length])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will moving setup_loggers here not lead to logging not being properly initialised if someone runs process not using the CLI or this class but by direct call of SingleRun or VaryRun?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has always been the case but you are correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a fix for this to this PR
Writes an additional logfile in the PROCESS working directory (where the input file is) that follows the name of the input file:
my.IN.DATproduces amy.process.logmy_IN.DATproduces amy_process.logThis does not remove the old
process.logfile which is created in the terminal working directory.