GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added NullHandlers to all loggers to prevent "No handler" messages by jamescnowell · Pull Request #300 · gitpython-developers/GitPython

Conversation

@jamescnowell

@jamescnowell jamescnowell commented Jun 25, 2015

Copy link
Copy Markdown

When the code is run without setting up loggers, the loggers have no
handlers for the emitted messages. The logging module displays:
No handlers could be found for logger "git.cmd" on the
console. By adding a NullHandler (a no-op) the message disappears,
and doesn't affect logging when other handlers are configured.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
James Nowell
Added NullHandlers to all loggers to preven "No handler" messages
aa0ccea
When the code is run without setting up loggers, the loggers have no
handlers for the emitted messages. The logging module displays:
`No handlers could be found for logger "git.cmd"` on the
console. By adding a NullHandler (a no-op) the message disappears,
and doesn't affect logging when other handlers are configured.
@jamescnowell

jamescnowell commented Jun 25, 2015

Copy link
Copy Markdown
Author

So I see the CI build ran with Python 2.6. Is there a list of supported Python versions? I can add a NullHandler as described here, but I'm not sure whre you would want that to live: https://docs.python.org/release/2.6/library/logging.html#configuring-logging-for-a-library

Edit: Looks like more stuff failed. I'm working on that too. Also noticed the CI process lists the versions it tests against.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jamescnowell

jamescnowell commented Jun 25, 2015

Copy link
Copy Markdown
Author

I'm not able to reproduce the error on my machine in Python 2.7. Also on the CI build, 'FOO' is totally in the exception. I'm not really sure what's supposed to be going on:

GitCommandError: 'Error when fetching: fatal: protocol error: bad line length character: FOO' returned with exit code 2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron merged commit aa0ccea into gitpython-developers:master Jun 26, 2015
@Byron Byron added this to the v1.0.2 - Fixes milestone Jun 26, 2015
@Byron

Byron commented Jun 26, 2015

Copy link
Copy Markdown
Member

Thanks a for your contribution!

I took the liberty to add the required NullHandler implementation myself. Besides, you are right, the Foo test is entirely unrelated to this PR, and needs additional attention.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron

Byron commented Jun 26, 2015

Copy link
Copy Markdown
Member

You can watch the development stream on youtube.

GitPython #10 [PR 300 - add logging Null handlers]

thumb

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jamescnowell
jamescnowell deleted the loggingNullHandlers branch June 26, 2015 12:59
@bpoldrack bpoldrack mentioned this pull request Aug 31, 2017
BF: Added missing NullHandler to logger in git.remote #666
Merged
@EliahKagan EliahKagan mentioned this pull request Jan 23, 2024
NullHandler added to all but git.repo.base logger #1806
Closed
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Jan 23, 2024
@EliahKagan
Deprecate git.util.NullHandler
741dfd3
The NullHandler class in git.util was added when merging gitpython-developers#300, to
allow a noop handler to be used on Python 2.6, since the standard
library logging.NullHandler class was added in Python 2.7.

When introduced in d1a9a23, the git.util.NullHandler class was also
patched into the logging module, but that has no longer been done
since 2fced2e (gitpython-developers#979), nor does GitPython make other use of it.

This also changes the parameter type annotation on the emit method
from `object` to `logging.LogRecord`, which is the expeced type.
@EliahKagan EliahKagan mentioned this pull request Jan 23, 2024
Remove git.util.NullHandler #1807
Merged
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Jan 26, 2024
@EliahKagan
Don't add NullHandlers
bc42ee5
This stops adding `NullHandler` instances to GitPython's loggers.
As noted in gitpython-developers#1806, when they were added in gitpython-developers#300 this prevented
errors when GitPython logged messages and logging was not enabled,
but since Python 3.2 there is a logger of last resort providing a
nicer default behavior of showing the messages. (They are still
shown with better formatting if logging is configured, even if
just done with logging.basicConfig(), so applications should still
typically configure logging.)
@EliahKagan EliahKagan mentioned this pull request Jan 26, 2024
Don't suppress messages when logging is not configured #1813
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

v1.0.2 - Fixes

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jamescnowell @Byron
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.