Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
5fc92619
Commit
5fc92619
authored
8 years ago
by
Richard van der Hoff
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1982 from matrix-org/rav/sighup_for_logconfig
Reread log config on SIGHUP
parents
7eae6eaa
9072a8c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/config/logger.py
+19
-10
19 additions, 10 deletions
synapse/config/logger.py
with
19 additions
and
10 deletions
synapse/config/logger.py
+
19
−
10
View file @
5fc92619
...
@@ -153,14 +153,6 @@ def setup_logging(log_config=None, log_file=None, verbosity=None):
...
@@ -153,14 +153,6 @@ def setup_logging(log_config=None, log_file=None, verbosity=None):
logger
.
info
(
"
Closing log file due to SIGHUP
"
)
logger
.
info
(
"
Closing log file due to SIGHUP
"
)
handler
.
doRollover
()
handler
.
doRollover
()
logger
.
info
(
"
Opened new log file due to SIGHUP
"
)
logger
.
info
(
"
Opened new log file due to SIGHUP
"
)
# TODO(paul): obviously this is a terrible mechanism for
# stealing SIGHUP, because it means no other part of synapse
# can use it instead. If we want to catch SIGHUP anywhere
# else as well, I'd suggest we find a nicer way to broadcast
# it around.
if
getattr
(
signal
,
"
SIGHUP
"
):
signal
.
signal
(
signal
.
SIGHUP
,
sighup
)
else
:
else
:
handler
=
logging
.
StreamHandler
()
handler
=
logging
.
StreamHandler
()
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
...
@@ -169,8 +161,25 @@ def setup_logging(log_config=None, log_file=None, verbosity=None):
...
@@ -169,8 +161,25 @@ def setup_logging(log_config=None, log_file=None, verbosity=None):
logger
.
addHandler
(
handler
)
logger
.
addHandler
(
handler
)
else
:
else
:
with
open
(
log_config
,
'
r
'
)
as
f
:
def
load_log_config
():
logging
.
config
.
dictConfig
(
yaml
.
load
(
f
))
with
open
(
log_config
,
'
r
'
)
as
f
:
logging
.
config
.
dictConfig
(
yaml
.
load
(
f
))
def
sighup
(
signum
,
stack
):
# it might be better to use a file watcher or something for this.
logging
.
info
(
"
Reloading log config from %s due to SIGHUP
"
,
log_config
)
load_log_config
()
load_log_config
()
# TODO(paul): obviously this is a terrible mechanism for
# stealing SIGHUP, because it means no other part of synapse
# can use it instead. If we want to catch SIGHUP anywhere
# else as well, I'd suggest we find a nicer way to broadcast
# it around.
if
getattr
(
signal
,
"
SIGHUP
"
):
signal
.
signal
(
signal
.
SIGHUP
,
sighup
)
# It's critical to point twisted's internal logging somewhere, otherwise it
# It's critical to point twisted's internal logging somewhere, otherwise it
# stacks up and leaks kup to 64K object;
# stacks up and leaks kup to 64K object;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment