Ticket #869 (closed enhancement: wontfix)
[patch] config.py/startup.py log_config_map
Reported by: | rune.hansen@… | Owned by: | anonymous |
---|---|---|---|
Priority: | normal | Milestone: | 1.x |
Component: | TurboGears | Version: | 0.9a6 |
Severity: | normal | Keywords: | logging |
Cc: |
Description
This is a proposition. I don't think this should be the final implementation. I'll leave that to those who have a better understanding of the startup process of tg/cp than me. The motivation is that I'd really like to see the servers configuration parameters when running in production mode.
config.py - (method is basically a copy/paste of method in cherrypy:config.py) def logConfigMap(): """Log server configuration parameters""" log = logging.getLogger("turbogears.access") log.info("Server parameters:") serverVars = [ 'server.environment', 'server.log_to_screen', 'server.log_file', 'server.log_tracebacks', 'server.log_request_headers', 'server.protocol_version', 'server.socket_host', 'server.socket_port', 'server.socket_file', 'server.reverse_dns', 'server.socket_queue_size', 'server.thread_pool', ] for var in serverVars: log.info("%s %s: %s" % ("CONFIG",var, get(var)))
startup.py - (if server.log_config_map, log config to access_out) def start_server(root): cherrypy.root = root if turbogears.config.get("server.log_config_map",False): turbogears.config.logConfigMap() if turbogears.config.get("tg.fancy_exception", False): cherrypy.server.start(server=SimpleWSGIServer()) else: cherrypy.server.start()
The main "problem" is that the output produced by a prod.cfg file is this:
Server parameters: CONFIG server.environment: production CONFIG server.log_to_screen: True CONFIG server.log_file: server.logs CONFIG server.log_tracebacks: True CONFIG server.log_request_headers: False CONFIG server.protocol_version: HTTP/1.0 CONFIG server.socket_host: CONFIG server.socket_port: 8080 CONFIG server.socket_file: CONFIG server.reverse_dns: False CONFIG server.socket_queue_size: 5 CONFIG server.thread_pool: 10
Clearly "log_to_screen" should be false, but isn't..
Change History
comment:1 Changed 12 years ago by kevin
- Summary changed from [PATCH] config.py/startup.py log_config_map to config.py/startup.py log_config_map
comment:2 Changed 12 years ago by jorge.vargas
- Milestone changed from 1.0b1 to 1.0b3
fixing kevin's post.
- move it to startTurboGears (so that everything is configured properly before it displays)
- don't log to turbogears.access -- that'll be painful for anyone trying to analyze the logs
- log to turbogears.config at info level
- rather than using a special config variable to turn it on, just use standard logging config (ie configure logging for turbogears.config to show up at the INFO level)
comment:4 Changed 11 years ago by alberto
- Milestone changed from 1.1 to __unclassified__
Batch moved into unclassified from 1.1 to properly track progress on the later
comment:5 Changed 9 years ago by jorge.vargas
- Summary changed from config.py/startup.py log_config_map to [patch] config.py/startup.py log_config_map
- Milestone changed from __unclassified__ to 1.x
comment:6 Changed 9 years ago by Chris Arndt
- Status changed from new to closed
- Resolution set to wontfix
Cruft ticket. Anyway, I don't think this belongs into TurboGears. If you want to log the server config at startup, write a function for it and put it in call_on_startup. Closing ticket as wontfix.
Here's how I think something like this can work: