Skip to content
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

log_level=0 does not completely disable logging #96

Open
jschueller opened this issue May 6, 2021 · 6 comments
Open

log_level=0 does not completely disable logging #96

jschueller opened this issue May 6, 2021 · 6 comments
Labels

Comments

@jschueller
Copy link
Contributor

currently pyfmi defaults to opening log file in the current dir by default when log_file_name=""
now I want to disable logs because the current directory is not writeable so I set log_level=0
but pyfmi still tries to open a log file
is this expected, or do we need another log level ?

cc @modelonrobinandersson @agnesramle, since you're working on streams

@modelonrobinandersson
Copy link
Collaborator

currently pyfmi defaults to opening log file in the current dir by default when log_file_name=""
now I want to disable logs because the current directory is not writeable so I set log_level=0
but pyfmi still tries to open a log file
is this expected, or do we need another log level ?

cc @modelonrobinandersson @agnesramle, since you're working on streams

Hi!

I believe that this is a bug, it seems that we do not take the log level into consideration before we try to open a log file.

@chria
Copy link
Collaborator

chria commented May 26, 2021

@jschueller This is now fixed in 2.8.8

@chria chria closed this as completed May 26, 2021
@jschueller
Copy link
Contributor Author

seems it was reverted in 2.8.10, should I reopen ?

@chria chria reopened this May 31, 2021
@chria
Copy link
Collaborator

chria commented May 31, 2021

Correct, It was reverted due to concerns that it might be confusing and cause regressions for users. We'll look at again in the near future so see what we can do to remove some of the concerns that was raised.

@modelonrobinandersson
Copy link
Collaborator

By the way @jschueller, if you still have issues with your current directory not being writable, you can now (since last year I believe) log to a stream and that way "get around" the issue with the empty log file being generated. For example we have a few tests where we use io.StringIO. It's not a solution to this issue but just wanted to let you know.

@jschueller
Copy link
Contributor Author

I have another workaround in the current code: set the file in /tmp:
https://github.com/openturns/otfmi/blob/master/otfmi/fmi.py#L34
but thanks, StringIO is maybe simpler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants