Skip to content

Commit 9f49a98

Browse files
logging: address review comments
Co-authored-by: Raghavendra Maddikery <raghav.maddikery@gmail.com> Signed-off-by: Cvam7 <108720572+ShivamPatidar24@users.noreply.github.com>
1 parent af21cd1 commit 9f49a98

7 files changed

Lines changed: 63 additions & 22 deletions

File tree

MODULE.bazel.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel_common/score_modules_target_sw.MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
bazel_dep(name = "score_baselibs")
1818
git_override(
1919
module_name = "score_baselibs",
20-
commit = "cab36dd7de92c282f67e78e88032e08585803528",
20+
commit = "ac3eb431b05ec37a5c346a6230c62e35dfbd8884",
2121
remote = "https://github.com/eclipse-score/baselibs.git",
2222
)
2323

@@ -72,11 +72,11 @@ git_override(
7272
bazel_dep(name = "score_logging")
7373
git_override(
7474
module_name = "score_logging",
75-
commit = "3da15793ed76bc8b97cffe379345f3c3d61c17cd",
75+
commit = "9faad72199cbc2259b1fe4d712c5c769cdfd954e",
7676
patch_strip = 1,
7777
patches = [
7878
"//patches/logging:001-logging-example-visibility.patch",
79-
"//patches/logging:002-deps-visibility.patch",
79+
"//patches/logging:002-rules-pkg-dependency.patch",
8080
],
8181
remote = "https://github.com/eclipse-score/logging.git",
8282
)

feature_integration_tests/itf/test_remote_logging.py

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
CAPTURE_DURATION_SECONDS = 10
2828

2929
# DLT message identifiers for datarouter statistics
30-
31-
APP_ID = "EXA"
32-
CTX_ID = "DFLT"
30+
APP_ID = "DR"
31+
CTX_ID = "STAT"
3332

3433
_QNX_DATAROUTER_CHECK_CMD = "/proc/boot/pidin | /proc/boot/grep datarouter"
3534
_LINUX_DATAROUTER_CHECK_CMD = "ps -ef | grep datarouter | grep -v grep"
@@ -41,9 +40,6 @@
4140
"./datarouter --no_adaptive_runtime > /dev/null 2>&1 &"
4241
)
4342
_LINUX_DATAROUTER_START_CMD = "cd /usr/bin/datarouter && nohup ./datarouter --no_adaptive_runtime > /dev/null 2>&1 &"
44-
45-
46-
_LOGGINGAPP_START_CMD = "cd /showcases/data/logging/logging_app/etc && nohup /showcases/bin/logging_app &"
4743
# Multicast route directs all multicast traffic (224.0.0.0/4) out of the containers
4844
# network interface required for DLT messages to reach the host via the Docker bridge.
4945
_LINUX_CHECK_MULTICAST_ROUTE_CMD = "ip route add 224.0.0.0/4 dev eth0 2>/dev/null || true"
@@ -89,7 +85,7 @@ def datarouter_running(target):
8985
yield
9086

9187

92-
def test_remote_logging(datarouter_running, target, dlt_config):
88+
def test_remote_logging(datarouter_running, dlt_config):
9389
"""Verifies remote logging of Dataraouter
9490
9591
Starts Datarouter on the target if not already running, then
@@ -104,10 +100,6 @@ def test_remote_logging(datarouter_running, target, dlt_config):
104100
print_to_stdout=True,
105101
binary_path=dlt_config.dlt_receive_path,
106102
) as window:
107-
logger.info("Starting logging app to generate DLT messages..")
108-
exit_code, out = target.execute(_LOGGINGAPP_START_CMD)
109-
logger.debug("Logging app start command exit_code=%s", exit_code)
110-
111103
time.sleep(CAPTURE_DURATION_SECONDS)
112104

113105
record = window.record(filters=[(APP_ID, CTX_ID)])
@@ -119,3 +111,46 @@ def test_remote_logging(datarouter_running, target, dlt_config):
119111
assert message_count > 1, (
120112
f"Expected atleast one DLT message with app_id: {APP_ID} and context_id: {CTX_ID}, but got {message_count}"
121113
)
114+
115+
116+
# DLT message identifiers for the Logging App
117+
LOGGING_APP_ID = "EXA"
118+
LOGGING_CTX_ID = "DFLT"
119+
120+
_LOGGINGAPP_START_CMD = "cd /showcases/data/logging/logging_app/etc && nohup /showcases/bin/logging_app &"
121+
122+
123+
def test_logging_app_logs_forwarded_to_dlt(datarouter_running, target, dlt_config):
124+
"""Verifies that Logging App logs are forwarded to DLT."""
125+
126+
with DltWindow(
127+
protocol=Protocol.UDP,
128+
host_ip=dlt_config.host_ip,
129+
multicast_ips=dlt_config.multicast_ips,
130+
print_to_stdout=True,
131+
binary_path=dlt_config.dlt_receive_path,
132+
) as window:
133+
logger.info("Starting logging_app...")
134+
exit_code, out = target.execute(_LOGGINGAPP_START_CMD)
135+
136+
logger.info("logging_app start exit_code=%s", exit_code)
137+
logger.info(out.decode(errors="replace"))
138+
139+
assert exit_code == 0, "Failed to start logging_app"
140+
141+
time.sleep(CAPTURE_DURATION_SECONDS)
142+
143+
record = window.record(filters=[(LOGGING_APP_ID, LOGGING_CTX_ID)])
144+
messages = record.find(query=dict(apid=LOGGING_APP_ID, ctid=LOGGING_CTX_ID))
145+
146+
logger.debug(
147+
"Found %d messages with app_id=%s, context_id=%s",
148+
len(messages),
149+
LOGGING_APP_ID,
150+
LOGGING_CTX_ID,
151+
)
152+
153+
assert len(messages) > 0, (
154+
f"Expected at least one DLT message with app_id={LOGGING_APP_ID} "
155+
f"and context_id={LOGGING_CTX_ID}, but got {len(messages)}"
156+
)

known_good.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"target_sw": {
44
"score_baselibs": {
55
"repo": "https://github.com/eclipse-score/baselibs.git",
6-
"hash": "cab36dd7de92c282f67e78e88032e08585803528",
6+
"hash": "ac3eb431b05ec37a5c346a6230c62e35dfbd8884",
77
"metadata": {
88
"extra_test_config": [
99
"@score_baselibs//score/json:base_library=nlohmann",
@@ -97,10 +97,10 @@
9797
},
9898
"score_logging": {
9999
"repo": "https://github.com/eclipse-score/logging.git",
100-
"hash": "3da15793ed76bc8b97cffe379345f3c3d61c17cd",
100+
"hash": "9faad72199cbc2259b1fe4d712c5c769cdfd954e",
101101
"bazel_patches": [
102102
"//patches/logging:001-logging-example-visibility.patch",
103-
"//patches/logging:002-deps-visibility.patch"],
103+
"//patches/logging:002-rules-pkg-dependency.patch"],
104104
"metadata": {
105105
"code_root_path": "//score/mw/...",
106106
"extra_test_config": [
File renamed without changes.

showcases/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Logging Example
1+
# Logging App Demo
22

3-
This example demonstrates logging with all log levels via Console Logging and Remote Logging.
3+
This Logging App demonstrates logging using mw::log with all log levels and configured backends (kConsole|kRemote|kFile) enabled.
44

5-
For remote logging details, refer to the following documentation:
5+
For remote (DLT) logging, please refer to the following documentation:
66

77
[Remote logging](https://github.com/eclipse-score/logging/blob/main/score/datarouter/doc/guideline/dlt_capture_demo.md)

showcases/standalone/logging.score.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "Logging example",
3-
"description": "Example for running logging with all log levels via remote and console",
2+
"name": "LoggingApp Demo",
3+
"description": "A Logging app that demonstrates logging with mw::log with kConsole|kRemote|kFile config.",
44
"apps": [
55
{
66
"path": "/bin/sh",

0 commit comments

Comments
 (0)