Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
a0bb07d0
Commit
a0bb07d0
authored
5 months ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Change logfile compression to bzip2
parent
963aa3e8
No related branches found
No related tags found
1 merge request
!1074
[Webservice] Common log directory, rotate log files weekly
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webservice/common.py
+3
-3
3 additions, 3 deletions
webservice/common.py
with
3 additions
and
3 deletions
webservice/common.py
+
3
−
3
View file @
a0bb07d0
...
...
@@ -4,8 +4,8 @@
# Implement the systemd notify protocol without external dependencies.
# Taken from the sd_notify man page
import
bz2
import
errno
import
gzip
import
logging
import
os
import
shutil
...
...
@@ -45,7 +45,7 @@ def file_and_stderr_logs(path: Path):
# From Python logging cookbook: compress logs when they're rotated
def
rotator
(
source
,
dest
):
with
open
(
source
,
'
rb
'
)
as
f_in
:
with
gzip
.
open
(
dest
,
'
wb
'
)
as
f_out
:
with
bz2
.
open
(
dest
,
'
wb
'
)
as
f_out
:
shutil
.
copyfileobj
(
f_in
,
f_out
)
os
.
remove
(
source
)
...
...
@@ -55,7 +55,7 @@ def file_and_stderr_logs(path: Path):
atTime
=
time
(
12
,
0
),
# At midday (after experiments finish)
backupCount
=
40
,
# weeks of logs to keep
)
filehandler
.
namer
=
lambda
name
:
name
+
"
.
gz
"
filehandler
.
namer
=
lambda
name
:
name
+
"
.
bz2
"
filehandler
.
rotator
=
rotator
filehandler
.
setFormatter
(
logging
.
Formatter
(
'
%(asctime)s - %(name)s - %(levelname)s - [%(filename)s:%(lineno)d] %(message)s
'
# noqa
...
...
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