Skip to content
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

Respect logger_class setting unless statsd is on #853

Merged
merged 1 commit into from
Aug 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ The `Statsd` logger overrides `gunicorn.glogging.Logger` to track
all requests. The following metrics are generated:

* ``gunicorn.requests``: request rate per second
* ``gunicorn.request.duration``: histogram of request duration
* ``gunicorn.request.duration``: histogram of request duration (in millisecond)
* ``gunicorn.workers``: number of workers managed by the arbiter (gauge)
* ``gunicorn.log.critical``: rate of critical log messages
* ``gunicorn.log.error``: rate of error log messages
Expand Down
6 changes: 3 additions & 3 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def logger_class(self):
if uri == "simple":
# support the default
uri = "gunicorn.glogging.Logger"

# if statsd is on, automagically switch to the statsd logger
if 'statsd_host' in self.settings:
if 'statsd_host' in self.settings and self.settings['statsd_host'].value is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be written simply as if self.settings.get('statsd_host') is not None

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just my style. Ignore me. It's fine :-D
🍻

logger_class = util.load_class("gunicorn.instrument.statsd.Statsd",
section="gunicorn.loggers")
else:
Expand Down Expand Up @@ -1646,7 +1646,7 @@ class StatsdHost(Setting):
section = "Logging"
cli = ["--statsd-host"]
meta = "STATSD_ADDR"
default = "localhost:8125"
default = None
validator = validate_hostport
desc ="""\
host:port of the statsd server to log to
Expand Down