Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Log MatomNom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libre
Log MatomNom
Commits
9ad9888e
Commit
9ad9888e
authored
Nov 27, 2020
by
Michał Woźniak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP:
#7
ignoring the exception that needs to be ignored
parent
133c7a3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
logwatch.py
logwatch.py
+26
-4
No files found.
logwatch.py
View file @
9ad9888e
...
...
@@ -15,12 +15,34 @@ import shutil
import
logging
import
threading
"""
def excepthook(t, val, traceback):
logging.debug("Exception type: %s" % t)
sys.__excepthook__(t, val, traceback)
sys.excepthook = excepthook
thanks to Jakub Bacic:
https://gist.github.com/jakub-bacic/548560c51193793a537cf6c3bce41429
Install thread excepthook.
By default, all exceptions raised in thread run() method are caught internally
by the threading module (see _bootstrap_inner method). Current implementation
simply dumps the traceback to stderr and did not exit the process.
This change explicitly catches exceptions and invokes sys.excepthook handler.
"""
_init
=
import_logs
.
threading
.
Thread
.
__init__
def
excinit
(
self
,
*
args
,
**
kwargs
):
_init
(
self
,
*
args
,
**
kwargs
)
_run
=
self
.
run
def
run
(
*
args
,
**
kwargs
):
try
:
_run
(
*
args
,
**
kwargs
)
except
BailException
:
logging
.
debug
(
'BailException caught'
)
self
.
run
=
run
# we're monkey patching a module imported in a module we import
# this is absolutely haram
import_logs
.
threading
.
Thread
.
__init__
=
excinit
# we have an issue with ingestion
class
IngestionException
(
Exception
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment