#8691 closed enhancement (fixed)
separator in trac.log for reload/restart
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11.6 |
Component: | general | Version: | none |
Severity: | normal | Keywords: | logging patch |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
It will help a lot to see a separator in trac.log that is written on restart/reload (when Trac reloads all plugins), because it is rather hard to spot session starts, especially in DEBUG mode.
Something like:
2009-09-24 07:02:41,080 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None 2009-09-24 07:02:41,177 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None 2009-09-24 07:11:19,017 Trac[env] INFO: Reloading environment due to configuration change 2009-09-24 07:11:19,041 --------------------------------------[ Start ]------- 2009-09-24 07:11:19,041 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect
Attachments (3)
Change History (13)
comment:1 by , 15 years ago
Milestone: | → 0.11.6 |
---|
comment:2 by , 15 years ago
Keywords: | logging added |
---|
by , 15 years ago
Attachment: | separator.diff added |
---|
by , 15 years ago
Attachment: | t8691-separator-on-restart.diff added |
---|
slightly different and simpler approach, shows a '*** environment shutdown ***
line upon shutdown.
comment:4 by , 15 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
Please have a look at t8691-separator-on-restart.diff (applies on 0.11-stable, r8764).
I think this amounts to the same and is a bit simpler than messing with the logger_factory
internals like separator.diff did.
comment:5 by , 15 years ago
I like the simpler approach as well. But won't we get several entries every time, one for each Apache/fcgi process? That might be a bit ugly.
comment:6 by , 15 years ago
Well, we also get the full list of startup messages for each process, this request was about better identify that sequence. Note also that the processes won't necessarily restart all at the same time.
I think I'll change from environment shutdown to environment startup also.
by , 15 years ago
Attachment: | t8691-separator-on-restart.2.diff added |
---|
Display an -------- environment startup --------
line in the log, when the environment is created.
follow-up: 8 comment:7 by , 15 years ago
My original patch is messing with logger factory for three reasons:
- Display start separator as early as possible - before any logging starts, because as a plugin/trac developer I am not aware when environment is created (shame, eh?), but if the code is in logger factory - I am absolutely sure that if I catch any bugs - there is no relevant to it output that is located above this line
I originally came to this idea when tracking reload of my plugin in development. Where comes information related to these plugin reload - before or after environment startup?
- I want to see separator in log as clearly as possible without obscure "Trac[xxx] INFO:" prefixes.
- Weak attempt to make it optional (advanced log analyzers can separate batches by time/date/pid)
follow-up: 9 comment:8 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to anatoly <techtonik@…>:
- Display start separator as early as possible
It is done as early as possible - doing it inside logger_factory
or right after the logger_factory
was called makes little difference.
because as a plugin/trac developer I am not aware when environment is created
Nothing can possibly happen in plugins without an Environment. The Environment sets up the logging, then deals with plugins.
- I want to see separator in log as clearly as possible without obscure "Trac[xxx] INFO:" prefixes.
Well, the -------------------------- ... -----------------------
line should be easy to spot. Give it a try.
- Weak attempt to make it optional (advanced log analyzers can separate batches by time/date/pid)
Alternatively, this can be seen as a good reason to always keep the obscure prefix ;-)
Anyway, as Remy was also not that enthusiastic about the original patch, I committed the simpler version.
Latest patch applied in [8795].
comment:9 by , 15 years ago
Replying to cboos:
- Display start separator as early as possible
It is done as early as possible - doing it inside
logger_factory
or right after thelogger_factory
was called makes little difference.
You have my blessings then. =)
Good idea. I wonder if it makes sense to use "critical" level here, even if it's not an error, it's something we'd like to see at any logging level.