-
Notifications
You must be signed in to change notification settings - Fork 151
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
Perfomance decrease in DEBUG
logging level
#483
Comments
Thanks for raising this. From what I've read in the Python documentation, we are using logging in the recommended way:
https://docs.python.org/3/howto/logging.html#logging-advanced-tutorial The statement on the thread you linked to says we are using the root logger, which I don't think we are - that would be However I'm wondering if we could add a NullHandler to silence messages unless a user or application explicitly enables them by adding a handler... Per discussion here: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library |
@kinverarity1 agree but maybe @lassoan simply meant to explicitely set another logging level to logger = logging.getLogger(__name__) I added few lines (it is enough to change only print('reader.py, logger level before set: ' + str(logger.level)) # the output tells me that logger.level = 0
logger.setLevel(logging.INFO)
print('reader.py, logger level after set: ' + str(logger.level)) # the output tells me that logger.level = 20 As you can see by default the With this line
according to documentation that could solve the problem |
I can confirm that So, it seems that the only unusual behavior of lasio is that it logs tons of messages at debug level, which can significantly slow down the execution. A few potential solutions:
|
I'm happy to change some of these messages to |
- Adds add_logging_level(level_name, level) function from https://stackoverflow.com/a/35804945/596328 (authored by Mad Physicist) - Adds TRACE_LASIO logging level - Adds trace_lasio(message) method to Logger - Changes the logger.debug call done for each line in the data section to a logger.trace_lasio call. Refer to issue #483
@kerim371 if you are able to test the |
@kinverarity1 thank you very much, it seems now it works fast as expected.
then inside my Slicer's python shell (wich sets import lasio
las=lasio.read(r'd:d\A_Kerbel.las') less than a second has past to perform these two lines of code |
Thanks for the update! |
Describe the bug
When logging is set to
DEBUG
:then perfomance is greatly decrease and more than 80% of time is spent on logging.
To Reproduce
Steps to reproduce the behavior:
DEBUG
:Expected behavior
I guess debug should take less than 80% of the time
Software versions (please complete the following information):
Additional context
Please see my topic dedicated to this problem. Here you can simply find all the information needed to understand the problem.
P.S. I'm not much expert in profiling and I only have little experience of working in python so I appologize if I explained some staff cumbersome
The text was updated successfully, but these errors were encountered: