Skip to content

LOG: added printout of rcParams at debug level#10039

Closed
jklymak wants to merge 1 commit into
matplotlib:masterfrom
jklymak:log-rcparams
Closed

LOG: added printout of rcParams at debug level#10039
jklymak wants to merge 1 commit into
matplotlib:masterfrom
jklymak:log-rcparams

Conversation

@jklymak

@jklymak jklymak commented Dec 18, 2017

Copy link
Copy Markdown
Member

PR Summary

In helping to debug #10016 I noted that there is no good way to see what the rcParams are in the debug interface. This seemed easy to add

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Slightly concerned about the verbosity.

@jklymak

jklymak commented Dec 18, 2017

Copy link
Copy Markdown
Member Author

Yeah if you set level to DEBUG you get a lot of output and it basically needs to go in a file. OTOH I don’t think there is any reason to be shy about verbose output when using debug.

The motivation here is to just ask the user for one file rather than the debug output and the matpltolibrc. But I don’t feel strongly if this is seen as cluttering up the debug info.

FWIW I usually put the logging info after the matpltolib import to keep the log shorter without all the startup info

@efiring efiring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In addition, it might be good to include the output of matplotlib.get_fname(), which shows the source of the matplotlibrc file that might have modified the rcParams. This is probably more valuable for debugging than the full rcParams.

locale.setlocale(locale.LC_ALL, '')

_log.debug('rcParams: ')
_log.debug(rcParams)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested consolidation:

_log.debug('rcParams:\n%s', rcParams)

I think this will result in a more nicely-formatted output because it will not have the extra header info from the logging formatter at the start of the rcParams list.

@jklymak

jklymak commented Dec 27, 2017

Copy link
Copy Markdown
Member Author

I think @anntzer has a PR to log the names of the various files, so I think that takes care of @efiring meta comment.

@anntzer

anntzer commented Dec 27, 2017

Copy link
Copy Markdown
Contributor

it's #9761.

@jklymak

jklymak commented Dec 28, 2017

Copy link
Copy Markdown
Member Author

OK, I think I agree that this is very very verbose, and indeed a more reliable way of asking a user for their rcParams is:

from matplotlib import rcParams

print(rcParams)

So I think I'll close this.

@jklymak jklymak closed this Dec 28, 2017
@jklymak jklymak deleted the log-rcparams branch March 5, 2019 16:10
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.

4 participants