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

You have some problem with django 1.10 #10

Open
dmitryTsatsarin opened this issue Mar 3, 2017 · 5 comments
Open

You have some problem with django 1.10 #10

dmitryTsatsarin opened this issue Mar 3, 2017 · 5 comments

Comments

@dmitryTsatsarin
Copy link

You have some problem with django 1.10
TypeError: 'LoggingMiddleware' object is not callable File "django/core/handlers/exception.py",

In django 1.10 your middleware class should be child of "MiddlewareMixin"

@jsmits
Copy link
Owner

jsmits commented May 11, 2017

Thanks, going to look into that.

Ref.: https://docs.djangoproject.com/en/1.11/topics/http/middleware/

@turacosianritesh
Copy link

Somewhere I keep getting this error from the package -

TypeError: %d format: a number is required, not unicode
Logged from file middleware.py, line 125
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/init.py", line 861, in emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/init.py", line 734, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/init.py", line 465, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/init.py", line 329, in getMessage
msg = msg % self.args
TypeError: %d format: a number is required, not unicode

@turacosianritesh
Copy link

Your create_logger seems to have an issue -

Making below change fixes the issue i.e replace %d with %s -
log_msg = (
"%(remote_address)s %(user_email)s %(method)s %(url)s %(status)s "
"%(content_length)s (%(request_time).2f seconds)"
)

Do you want me to raise a PR to fix this dude?

@turacosianritesh
Copy link

content_length and status attributes

@jsmits
Copy link
Owner

jsmits commented Mar 3, 2018

Yes, a PR would be nice. Thanks for reporting this.

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

No branches or pull requests

3 participants