mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'tweak/support-logs-threads' into 'dev'
Add a thread dump to support logs See merge request crafty-controller/crafty-4!769
This commit is contained in:
commit
75f149849a
@ -8,6 +8,7 @@ TBD
|
||||
### Tweaks
|
||||
- Add info note to default creds file ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/760))
|
||||
- Remove navigation label from sidebar ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/766))
|
||||
- Add a thread dump to support logs ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/769))
|
||||
### Lang
|
||||
- Add remaining `he_IL`, `th_TH` translations for 4.4.0 Release ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/761))
|
||||
<br><br>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
import pathlib
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
@ -251,6 +252,19 @@ class Controller:
|
||||
# Copy crafty logs to archive dir
|
||||
full_log_name = os.path.join(crafty_path, "logs")
|
||||
FileHelpers.copy_dir(os.path.join(self.project_root, "logs"), full_log_name)
|
||||
thread_dump = ""
|
||||
for thread in threading.enumerate():
|
||||
if sys.version_info >= (3, 8):
|
||||
thread_dump += (
|
||||
f"Name: {thread.name}\tIdentifier:"
|
||||
f" {thread.ident}\tTID/PID: {thread.native_id}\n"
|
||||
)
|
||||
else:
|
||||
print(f"Name: {thread.name}\tIdentifier: {thread.ident}")
|
||||
with open(
|
||||
os.path.join(temp_dir, "crafty_thread_dump.txt"), "a", encoding="utf-8"
|
||||
) as f:
|
||||
f.write(thread_dump)
|
||||
self.support_scheduler.add_job(
|
||||
self.log_status,
|
||||
"interval",
|
||||
|
Loading…
Reference in New Issue
Block a user