-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v3.6.x): fix and refine logs uploading (#280)
This PR fixes and removes the unwanted logs upload interval, refines the implementation of logs uploading. For the refinement side, the logging upload thread now has proper exit logic implemented. At otaclient exits, the logging uploader thread can gracefully exit now.
- Loading branch information
1 parent
c2e7f76
commit bc83e31
Showing
2 changed files
with
84 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2022 TIER IV, INC. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from __future__ import annotations | ||
|
||
import logging | ||
|
||
from otaclient.app import log_setting | ||
|
||
MODULE = log_setting.__name__ | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def test_server_logger(): | ||
test_log_msg = "emit one logging entry" | ||
|
||
# ------ setup test ------ # | ||
_handler = log_setting._LogTeeHandler() | ||
logger.addHandler(_handler) | ||
|
||
# ------ execution ------ # | ||
logger.info(test_log_msg) | ||
|
||
# ------ clenaup ------ # | ||
logger.removeHandler(_handler) | ||
|
||
# ------ check result ------ # | ||
_queue = _handler._queue | ||
_log = _queue.get_nowait() | ||
assert _log == test_log_msg |