Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added NullHandlers to all loggers to prevent "No handler" messages#300

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

jamescnowell
Copy link

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.

When the code is run without setting up loggers, the loggers have nohandlers for the emitted messages. The logging module displays:`No handlers could be found for logger "git.cmd"` on theconsole. By adding a NullHandler (a no-op) the message disappears,and doesn't affect logging when other handlers are configured.
@jamescnowell
Copy link
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.

@jamescnowell
Copy link
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

@ByronByron merged commitaa0ccea intogitpython-developers:masterJun 26, 2015
@ByronByron added this to thev1.0.2 - Fixes milestoneJun 26, 2015
@Byron
Copy link
Member

Thanks a for your contribution!

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

@Byron
Copy link
Member

You can watch the development streamon youtube.

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

thumb

@jamescnowelljamescnowell deleted the loggingNullHandlers branchJune 26, 2015 12:59
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 23, 2024
The NullHandler class in git.util was added when merginggitpython-developers#300, toallow a noop handler to be used on Python 2.6, since the standardlibrary logging.NullHandler class was added in Python 2.7.When introduced ind1a9a23, the git.util.NullHandler class was alsopatched into the logging module, but that has no longer been donesince2fced2e (gitpython-developers#979), nor does GitPython make other use of it.This also changes the parameter type annotation on the emit methodfrom `object` to `logging.LogRecord`, which is the expeced type.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 26, 2024
This stops adding `NullHandler` instances to GitPython's loggers.As noted ingitpython-developers#1806, when they were added ingitpython-developers#300 this preventederrors when GitPython logged messages and logging was not enabled,but since Python 3.2 there is a logger of last resort providing anicer default behavior of showing the messages. (They are stillshown with better formatting if logging is configured, even ifjust done with logging.basicConfig(), so applications should stilltypically configure logging.)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
v1.0.2 - Fixes
Development

Successfully merging this pull request may close these issues.

2 participants
@jamescnowell@Byron

[8]ページ先頭

©2009-2025 Movatter.jp