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

Set up and document logging for Gammapy #318

Merged
merged 1 commit into from Aug 10, 2015

Conversation

Projects
None yet
1 participant
@cdeil
Member

cdeil commented Aug 5, 2015

As discussed in #315 (comment) and astropy/package-template#134 it's not clear how to do logging "the right way" in Gammapy at the moment.

Whatever solution we'll come up with, I'll implement and document in this PR.

  • Decide how logging should work.
  • Change all logging calls to follow that convention
  • Change all command line tools to follow that convention
  • Document how and why logging is done this way

Here's what we do currently:
https://github.com/gammapy/gammapy/search?utf8=%E2%9C%93&q=logging

@cdeil cdeil added feature docs labels Aug 5, 2015

@cdeil cdeil self-assigned this Aug 5, 2015

@cdeil cdeil added this to the 0.4 milestone Aug 5, 2015

@cdeil cdeil added the infrastructure label Aug 5, 2015

@cdeil cdeil force-pushed the cdeil:logging branch from e11e186 to 54dcfab Aug 6, 2015

@cdeil cdeil changed the title from WIP: Set up and document good logging for Gammapy to Set up and document logging for Gammapy Aug 6, 2015

# format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
format = '%(levelname)-8s %(message)s [%(name)s]'
formatter = logging.Formatter(format)
log.handlers[0].setFormatter(formatter)

This comment has been minimized.

@cdeil

cdeil Aug 6, 2015

Member

I'm getting this error from gammapy-reflected-regions:

$ gammapy-reflected-regions 
Traceback (most recent call last):
  File "/Users/deil/Library/Python/3.4/bin/gammapy-reflected-regions", line 9, in <module>
    load_entry_point('gammapy==0.3.dev1428', 'console_scripts', 'gammapy-reflected-regions')()
  File "/Users/deil/Library/Python/3.4/lib/python/site-packages/gammapy-0.3.dev1428-py3.4-macosx-10.10-x86_64.egg/gammapy/scripts/reflected_regions.py", line 36, in main
    set_up_logging_from_args(args)
  File "/Users/deil/Library/Python/3.4/lib/python/site-packages/gammapy-0.3.dev1428-py3.4-macosx-10.10-x86_64.egg/gammapy/utils/scripts.py", line 89, in set_up_logging_from_args
    _configure_root_logger(level=level)
  File "/Users/deil/Library/Python/3.4/lib/python/site-packages/gammapy-0.3.dev1428-py3.4-macosx-10.10-x86_64.egg/gammapy/utils/scripts.py", line 111, in _configure_root_logger
    log.handlers[0].setFormatter(formatter)
IndexError: list index out of range

From other command line scripts like e.g. gammapy-find-obs it works fine, no error.
I don't see any difference between the two.

@embray – I guess that's not a robust way to format the root logger? Any advice what to do instead?

@cdeil cdeil force-pushed the cdeil:logging branch from 93bd0db to efecb38 Aug 10, 2015

@cdeil cdeil modified the milestones: 0.3, 0.4 Aug 10, 2015

@cdeil cdeil referenced this pull request Aug 10, 2015

Open

Improve logging from command line tools #320

0 of 3 tasks complete
@cdeil

This comment has been minimized.

Member

cdeil commented Aug 10, 2015

The build for the older Numpy versions errored like this:
https://travis-ci.org/gammapy/gammapy/jobs/74878696#L656

Error: HTTPError: 503 Server Error: Service Unavailable: https://conda.binstar.org/cxc/linux-64/sherpa-4.7b1-np18py27_2.tar.bz2

Restarting those now to see if that is a fluke or something that needs to be dealt with.

@cdeil

This comment has been minimized.

Member

cdeil commented Aug 10, 2015

Another timeout when accessing binstar for some other package:
https://travis-ci.org/gammapy/gammapy/jobs/74878696#L687
Looks like an unrelated binstar availability issue to me.
Merging this now so that I can move on...

cdeil added a commit that referenced this pull request Aug 10, 2015

Merge pull request #318 from cdeil/logging
Set up and document logging for Gammapy

@cdeil cdeil merged commit d270563 into gammapy:master Aug 10, 2015

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment