-
Notifications
You must be signed in to change notification settings - Fork 2
RDKEMW-12334-The log entries in remote-debugger.log #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cad6392
6fd8306
5839019
f291fc6
e99e019
b17c49a
b6626f3
b939aca
c7fd01e
749ad05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,21 @@ | ||
| /* | ||
| * uploadRRDLogs.c - Skeleton for C migration of uploadRRDLogs.sh | ||
| * If not stated otherwise in this file or this component's LICENSE file the | ||
|
Check failure on line 2 in src/uploadRRDLogs.c
|
||
| * following copyright and licenses apply: | ||
|
Check failure on line 3 in src/uploadRRDLogs.c
|
||
| * | ||
| * This file is auto-generated following HLD and implementation instructions. | ||
| * Copyright 2018 RDK Management | ||
| * | ||
| * Modules: Main Orchestration, Config Manager, System Info, Log Processing, Archive, Upload, Logging | ||
| * See: .github/docs/uploadRRDLogs_HLD.md | ||
| */ | ||
|
|
||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
Check failure on line 7 in src/uploadRRDLogs.c
|
||
| * 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. | ||
| */ | ||
|
|
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
|
|
@@ -27,13 +36,13 @@ | |
|
|
||
| int rrd_upload_orchestrate(const char *upload_dir, const char *issue_type) | ||
| { | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Entry\n", __FUNCTION__); | ||
|
|
||
| // Validate input parameters | ||
| if (!upload_dir || !issue_type) { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Invalid parameters\n", __FUNCTION__); | ||
| return 1; | ||
| } | ||
|
|
||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Executing binary to upload Debug info of ISSUETYPE=%s\n", __FUNCTION__, issue_type); | ||
|
|
||
| // 2. Initialize logging subsystem | ||
| // Logging is initialized by RDK_LOGGER macros; no explicit init needed | ||
|
|
@@ -61,6 +70,7 @@ | |
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: MAC: %s, Timestamp: %s\n", __FUNCTION__, mac_addr, timestamp); | ||
|
|
||
| // 5. Validate and prepare log directory | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Checking %s size and contents\n", __FUNCTION__, upload_dir); | ||
| if (rrd_logproc_validate_source(upload_dir) != 0) { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Invalid or empty upload directory: %s\n", __FUNCTION__, upload_dir); | ||
| return 6; | ||
|
|
@@ -81,7 +91,7 @@ | |
|
|
||
| // 6.5. Handle LOGUPLOAD_ENABLE special case (matching shell script lines 128-131) | ||
| if (strcmp(issue_type_sanitized, "LOGUPLOAD_ENABLE") == 0) { | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Handling LOGUPLOAD_ENABLE - checking for live logs\n", __FUNCTION__); | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Check and upload live device logs for the issuetype\n", __FUNCTION__); | ||
| if (rrd_logproc_handle_live_logs(upload_dir) != 0) { | ||
| RDK_LOG(RDK_LOG_WARN, LOG_REMDEBUG, "%s: Failed to handle live logs for LOGUPLOAD_ENABLE\n", __FUNCTION__); | ||
| } | ||
|
|
@@ -97,30 +107,33 @@ | |
|
|
||
| // 8. Create archive in /tmp/rrd/ directory (matching shell script line 127) | ||
| const char *rrd_log_dir = "/tmp/rrd/"; | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Creating %s tarfile from Debug Commands output\n", __FUNCTION__, archive_filename); | ||
| if (rrd_archive_create(upload_dir, rrd_log_dir, archive_filename) != 0) { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Failed to create archive %s\n", __FUNCTION__, archive_filename); | ||
| return 10; | ||
| } | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Archive created: %s\n", __FUNCTION__, archive_filename); | ||
|
|
||
| // 9. Upload archive from /tmp/rrd/ directory | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Invoking uploadSTBLogs binary to upload %s file\n", __FUNCTION__, archive_filename); | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: uploadSTBLogs parameters - server: %s, protocol: %s, http_link: %s, file: %s\n", | ||
| __FUNCTION__, config.log_server, config.upload_protocol, config.http_upload_link, archive_filename); | ||
| if (rrd_upload_execute(config.log_server, config.upload_protocol, config.http_upload_link, rrd_log_dir, archive_filename, upload_dir) != 0) { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Failed to upload archive\n", __FUNCTION__); | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: RRD %s Debug Information Report upload Failed!!!\n", __FUNCTION__, issue_type_sanitized); | ||
| // Cleanup on failure (matching shell script lines 139-140) | ||
| char archive_fullpath[512]; | ||
| snprintf(archive_fullpath, sizeof(archive_fullpath), "%s%s", rrd_log_dir, archive_filename); | ||
| rrd_archive_cleanup(archive_fullpath); | ||
| rrd_upload_cleanup_source_dir(upload_dir); | ||
| return 11; | ||
| } | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Archive uploaded successfully\n", __FUNCTION__); | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: RRD %s Debug Information Report upload Success\n", __FUNCTION__, issue_type_sanitized); | ||
|
|
||
| // 10. Cleanup archive and source directory (matching shell script line 143) | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Removing uploaded report %s\n", __FUNCTION__, archive_filename); | ||
| char archive_fullpath[512]; | ||
| snprintf(archive_fullpath, sizeof(archive_fullpath), "%s%s", rrd_log_dir, archive_filename); | ||
| rrd_archive_cleanup(archive_fullpath); | ||
| rrd_upload_cleanup_source_dir(upload_dir); | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Cleanup complete\n", __FUNCTION__); | ||
|
|
||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Exit\n", __FUNCTION__); | ||
| return 0; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message uses "issuetype" (all lowercase) which is inconsistent with other log messages that use "ISSUETYPE" or "issue_type". For consistency with the codebase style, this should be "issue type" (two words) or match the variable naming convention used elsewhere.