Skip to content

Conversation

@anshulagrawal2902
Copy link

@anshulagrawal2902 anshulagrawal2902 commented Dec 31, 2024

Purpose of PR?:

Fixes #2500

Does this PR introduce a breaking change?
This does change the way we use logging, and also the way to select logging level from CLI

If the changes in this PR are manually verified, list down the scenarios covered::
Setting log level was tested on the mswms cli using --loglevel option

Additional information for reviewer? :
This PR is an attempt to have better logging accross the codebase

Does this PR results in some Documentation changes?
We would need to change the documention to add the --loglevel option replacing --debug flag

Checklist:

@ReimarBauer ReimarBauer requested review from joernu76 and matrss January 2, 2025 11:26
Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see my comment

self.data_units[dataitem] = dataunit
else:
logging.debug("Please add units to plot variables")
mpl_logger.debug("Please add units to plot variables")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this likly will handle our needed output identical to the matplotlib logger which we want to supress in the output, or?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look also on the tests results

Copy link
Author

@anshulagrawal2902 anshulagrawal2902 Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you use just logging.debug() it uses a different logger (which is the root logger ) and not the matplotlib logger that we have defined. I am ensuring that we use our mpl_logger. This was a separate problem that I noticed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And about the original issue, I think we should be using common singleton logger. Hence, the statements

from mslib.utils import LOG

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And about the original issue, I think we should be using common singleton logger. Hence, the statements

from mslib.utils import LOG

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look also on the tests results

I did not get what you mean by this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look also on the tests results

I did not get what you mean by this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on bottom of your PR is a section with the CI Tests. Have a look on theire findings.


# keep the import after the version check. This creates all layers.
from mslib.mswms.wms import mswms_settings, server
from mslib.mswms.wms import mswms_settings, server, app as application
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app as application ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just moved the statement from top of the file to line 91. This is because we have logging statements in mslib.mswms.wms file and importing it will use logging without any configuration

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion, I had left the commented import app as application statement. Added a new commit.

@ReimarBauer
Copy link
Member

@ReimarBauer
Copy link
Member

@anshulagrawal2902
Copy link
Author

anshulagrawal2902 commented Jan 18, 2025

I currently targeted only the mswms module for logging, but I noticed as other modules are also using the setup_logging() fucntion, we would need to fix them too. Mentioning it here to set the right expectation for the completion of this PR.

@ReimarBauer
Copy link
Member

there is a conflict shown, can you try to solve the merge conflict?

@anshulagrawal2902
Copy link
Author

Hi Reimar, I fixed the linting flake8 errors and merge conflict caused due to the logging changes. Other failing tests are timing out, I don't believe these have to do with the changes I made. Is there anything I am missing ?

@ReimarBauer
Copy link
Member

If the work is continued, we can reopen it.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

more colors in textual output

2 participants