Comments (4)
You are right, I saw that dictionary and hence opened this issue.
But I can't fight maintenance mode :)
Thanks, closing.
from paste.
Can you provide the MY_FORMAT
that you are using that fails, and the traceback that happens when it fails? Without that it's hard to narrow down the issue.
from paste.
I wanted to go with a standard logging format:
MY_FORMAT = '[%(levelname)s] (%(filename)s:%(lineno)d) - %(message)s'
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/waitress/channel.py", line 356, in service
task.service()
File "/usr/lib/python3.6/site-packages/waitress/task.py", line 176, in service
self.execute()
File "/usr/lib/python3.6/site-packages/waitress/task.py", line 447, in execute
app_iter = self.channel.server.application(env, start_response)
File "/usr/lib/python3.6/site-packages/paste/translogger.py", line 69, in __call__
return self.application(environ, replacement_start_response)
File "/usr/lib/python3.6/site-packages/connexion/apps/abstract.py", line 248, in __call__
return self.app(environ, start_response)
File "/usr/lib/python3.6/site-packages/flask/app.py", line 2328, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib/python3.6/site-packages/flask/app.py", line 2318, in wsgi_app
return response(environ, start_response)
File "/usr/lib/python3.6/site-packages/werkzeug/wrappers/base_response.py", line 701, in __call__
start_response(status, headers)
File "/usr/lib/python3.6/site-packages/paste/translogger.py", line 67, in replacement_start_response
self.write_log(environ, method, req_uri, start, status, bytes)
File "/usr/lib/python3.6/site-packages/paste/translogger.py", line 99, in write_log
message = self.format % d
KeyError: 'levelname'
from paste.
Ah, okay. As you've probably already determined, there is a defined set of variables that you can provide, using Translogger, the left hand side in this dict:
d = {
'REMOTE_ADDR': remote_addr,
'REMOTE_USER': environ.get('REMOTE_USER') or '-',
'REQUEST_METHOD': method,
'REQUEST_URI': req_uri,
'HTTP_VERSION': environ.get('SERVER_PROTOCOL'),
'time': time.strftime('%d/%b/%Y:%H:%M:%S ', start) + offset,
'status': status.split(None, 1)[0],
'bytes': bytes,
'HTTP_REFERER': environ.get('HTTP_REFERER', '-'),
'HTTP_USER_AGENT': environ.get('HTTP_USER_AGENT', '-'),
}
To get the output that you want you're probably better off using either a different logging middleware, or a subclass of Translogger.
In any case, given that paste is in maintenance mode, and the code is behaving as designed (setting aside for the moment whether that design is good), this is not something that's going to change.
I'm not certain, but I suspect either waitress or flask should be able to provide you with different modes of logging that could fit your needs.
If all that makes sense, please close the issue.
from paste.
Related Issues (20)
- `PKG-INFO` in sdist is missing `License-File` HOT 3
- threading.Thread.isAlive is removed in Python 3.9 HOT 1
- base64.encodestring deprecation warning HOT 2
- gzip middleware adds a HTTP body when it shouldn't (e.g., HEAD requests) HOT 2
- add ipv6 support HOT 5
- translogger can fail if locale month is non ascii HOT 1
- Question. What's the licence of paste? HOT 2
- ImportError with setuptools 50.1.0 HOT 1
- the imp module is deprecated HOT 1
- 3.5.0: pytest warnings HOT 5
- 3.5.0: sphinx warnings HOT 5
- Missing license file in the wheel HOT 2
- Test failure with Python 3.11 HOT 2
- UnicodeDecodeError on German Date with Umlaut (ex. Mรคrz)
- Replace deprecated imp module with importlib HOT 1
- cgi and cgitb packages are deprecated and will be removed in Python 3.13 HOT 3
- RFE: is it possible to start making github releases?๐ค HOT 6
- calling request.parse_formvars twice results in GET parameters added twice HOT 2
- 3.10.0: Testing fails with some other Python module installed HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paste.