Skip to content

Conversation

@yurekami
Copy link

Summary

Problem

The httpx library logs HTTP request/response information at INFO level by default. When using ollama-python in applications with standard INFO-level logging, these verbose messages clutter the logs and obscure more important application messages.

Solution

Added a module-level configuration that sets the httpx logger level to WARNING:

logging.getLogger('httpx').setLevel(logging.WARNING)

This suppresses the verbose HTTP request logs while still allowing WARNING and ERROR level messages through.

Preserving User Control

Users who want to see HTTP request logs for debugging can still enable them by setting the httpx logger level back to INFO or DEBUG in their application:

import logging
logging.getLogger('httpx').setLevel(logging.INFO)

Test plan

  • Verified syntax is correct
  • All existing tests pass

🤖 Generated with Claude Code

By default, httpx logs HTTP request/response information at INFO level,
which clutters application logs with messages like:
  "HTTP Request: POST http://... 'HTTP/1.1 200 OK'"

This change sets the httpx logger to WARNING level by default, suppressing
these verbose logs. Users who want to see HTTP request logs can still enable
them by setting the httpx logger level back to INFO or DEBUG in their application:

    import logging
    logging.getLogger('httpx').setLevel(logging.INFO)

Fixes ollama#539

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant