Skip to content
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
06bfdfa
Deploy cla action
rdkcmf-jenkins Jun 24, 2025
f3f31b1
Update debug.ini (#18)
Abhinavpv28 Jul 14, 2025
e1980c5
RDKEMW-4794 : RDM Prints incorrect message for Codebig Path (#13)
Saranya2421 Jul 25, 2025
59e48d3
RDKEMW-6709: RDKLogger - Refactoring (#19)
dshett549 Aug 6, 2025
50bee88
Release of RDKLogger v2.0.0
karuna2git Aug 6, 2025
efe9c4e
RDKEMW-6709: RDKLogger - Refactoring (#19)
dshett549 Aug 6, 2025
0087a47
Release of RDKLogger v2.0.0
karuna2git Aug 6, 2025
6c05e48
RDKB-60970: RDKLogger OpenSource Migration (#20)
dshett549 Sep 1, 2025
6f16c07
Release of RDKLogger v2.1.0
karuna2git Sep 1, 2025
7b1e5cf
RDKB-60970: RDKLogger OpenSource Migration (#20)
dshett549 Sep 1, 2025
a46c1ca
Release of RDKLogger v2.1.0
karuna2git Sep 1, 2025
59387ab
[RDKC-16005]: RDKLogger OpenSource Migration (#21)
dshett549 Sep 8, 2025
f6df9f4
[RDKC-16005]: RDKLogger OpenSource Migration (#21)
dshett549 Sep 8, 2025
28d277a
Release of RDKLogger v2.2.0
karuna2git Sep 8, 2025
5303296
Release of RDKLogger v2.2.0
karuna2git Sep 8, 2025
a835dd3
RDKB-61752 : Add Legacy Function for Backward Compatibility (#23)
karuna2git Sep 23, 2025
5861164
Update Documentation for RDKLogger (#24)
karuna2git Sep 23, 2025
d186a56
RDKB-61752 : Add Legacy Function for Backward Compatibility (#23)
karuna2git Sep 23, 2025
35e2f74
Update Documentation for RDKLogger (#24)
karuna2git Sep 23, 2025
92065f0
Release of RDKLogger v2.3.0
karuna2git Sep 23, 2025
0cd6dc8
Merge branch 'main' into develop
karuna2git Sep 23, 2025
c28a19c
Merge branch 'develop' into feature/action-deploy-for/develop
rdkcmf-jenkins Sep 25, 2025
79e134a
Deploy cla action
rdkcmf-jenkins Sep 25, 2025
4f23fed
Merge pull request #15 from rdkcentral/feature/action-deploy-for/develop
Alan-Ryan Sep 25, 2025
370c54f
Deploy fossid_integration_stateless_diffscan_target_repo action
rdkcmf-jenkins Sep 29, 2025
33e6acd
Merge pull request #26 from rdkcentral/feature/actions/develop-fossid
Alan-Ryan Sep 29, 2025
3e2cdb3
RDKEMW-8798 : Post Code Coverage in the PR workflow (#27)
rosemarybennyy Oct 3, 2025
a0e2418
RDKEMW-8528: Remove logMilestone.sh & use the binary when needed (#28)
dshett549 Oct 3, 2025
3d25a4e
Update CODEOWNERS
sbarre01 Oct 8, 2025
695b825
Merge pull request #29 from rdkcentral/sbarre01-patch-1
sbarre01 Oct 8, 2025
3996cb2
RDKEMW-9247 : Moving rdklogger_milestone file from .cpp to .c (#30)
dshett549 Oct 10, 2025
c9ea7f3
RDKEMW-6710: RDKLogger - Improve L1 Test coverage (#31)
rosemarybennyy Oct 29, 2025
5f129d6
Revert "RDKEMW-8528: Remove logMilestone.sh & use the binary when nee…
karuna2git Oct 30, 2025
aa09d85
Release of v2.4.0
karuna2git Oct 31, 2025
cb6e345
RDKEMW-9545: [RDKLogger] Post Code Current Coverage & the latest in t…
rosemarybennyy Nov 11, 2025
8457a0a
Revert "RDKEMW-9545: [RDKLogger] Post Code Current Coverage & the lat…
karuna2git Nov 12, 2025
2f4ae96
RDKEMW-10792: Extending logger_init function to set level, format and…
dshett549 Dec 19, 2025
335e78d
RDKEMW-10792 : Added support for syslog, different format and etc (#42)
karuna2git Jan 6, 2026
746a547
RDKEMW-10792 : Update the Milestone log location
karuna2git Jan 8, 2026
ea90f87
RDKEMW-10792 : Added legacy layout and defined Milestone log location
karuna2git Jan 8, 2026
12136a6
RDKEMW-10792 : Added legacy layout and defined Milestone log location
karuna2git Jan 12, 2026
cbdb411
Release of v3.0.0
karuna2git Jan 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @rdkcentral/rdke_ghec_rdklogger_maintainer @rdkcentral/rdke_ghec_rdklogger_admin
* @rdkcentral/rdk_logger-maintainers
47 changes: 38 additions & 9 deletions .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ name: l1-tests

on:
push:
branches: [ main, 'release/**', develop, 'topic/**' ]
branches: [ main, 'release/**', develop, 'topic/**', 'support/**' ]
pull_request:
branches: [ main, 'release/**', develop, 'topic/**' ]
branches: [ main, 'release/**', develop, 'topic/**', 'support/**' ]

env:
WORK_DIR: ${{github.workspace}}
DEP_LIB: ${{github.workspace}}/dep_lib
RDKLOGGER_ROOT: ${{github.workspace}}/Rdklogger
RDKLOGGER_INSTALL_DIR: ${{github.workspace}}/Rdklogger/install
LD_LIBRARY_PATH: ${{github.workspace}}/install/lib
PKG_CONFIG_PATH: ${{github.workspace}}/install/lib/pkgconfig
RDKLOGGER_PREFIX: ${{github.workspace}}/install

jobs:
l1-tests:
Expand Down Expand Up @@ -39,6 +41,7 @@ jobs:
&&
sudo apt install -y tree automake libsqlite3-dev libcurl4-openssl-dev valgrind libgtest-dev lcov clang libsystemd-dev libboost-all-dev libwebsocketpp-dev meson libcunit1 libcunit1-dev


- name: Build gtest
run: |
cd /usr/src/gtest
Expand Down Expand Up @@ -68,7 +71,7 @@ jobs:
tar -xzf log4c-1.2.3.tar.gz
fi
cd "log4c-1.2.3"
./configure "--prefix=${DEP_LIB}/log4c-1.2.3/install"
./configure "--prefix=${{github.workspace}}/install"
make
make install

Expand All @@ -83,18 +86,44 @@ jobs:
autoconf
export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_memset=yes
export LOG4C_CFLAGS="-I${{env.DEP_LIB}}/log4c-1.2.3/install/include/log4c/ -I${{env.DEP_LIB}}/log4c-1.2.3/src/ -I${{env.DEP_LIB}}/log4c-1.2.3/src/log4c -I${{env.DEP_LIB}}/log4c-1.2.3/install/include/"
export LOG4C_LIBS="-L${{env.DEP_LIB}}/log4c-1.2.3/install/lib"
./configure --prefix=${{env.RDKLOGGER_INSTALL_DIR}}/lib --sysconfdir=${{env.RDKLOGGER_INSTALL_DIR}}/bin LOG4c_CFLAGS="-I${{env.DEP_LIB}}/log4c-1.2.3/src/ -I${{env.DEP_LIB}}/log4c-1.2.3/install/include/log4c/" LOG4C_LIBS="-L${{env.DEP_LIB}}/log4c-1.2.3/install/lib/liblog4c.so"
# Enable coverage flags if applicable
if [ "${{matrix.coverage}}" = "with-coverage" ]; then
export CFLAGS="-DLOGMILESTONE=ON -DONBOARDING_FILE=ON --coverage"
export CXXFLAGS="-DLOGMILESTONE=ON -DONBOARDING_FILE=ON --coverage"
export LDFLAGS="--coverage"
fi
./configure "--prefix=${{github.workspace}}/install"
make
make install

- name: Build and execute L1 unittesting for rdk_logger
run: |
mkdir -p /opt/logs
sudo touch /opt/logs/rdk_milestones.log
sudo chmod 666 /opt/logs/rdk_milestones.log
mkdir -p ${{env.RDKLOGGER_ROOT}}/unittests
UNITTESTS="${{env.RDKLOGGER_ROOT}}/unittests"
cp ${{github.workspace}}/install/bin/rdklogctrl ${UNITTESTS}/
cd ${UNITTESTS}
cmake -DRDKLOGGER_SOURCE_PATH=${{env.RDKLOGGER_ROOT}} -DDEP_LIB_PATH=${{env.DEP_LIB}} -DRDKLOGGER_UNITTEST_DIR=${UNITTESTS} -DCMAKE_INSTALL_PREFIX:PATH=${UNITTESTS}/build -DDEBUG_CONF_FILE="\"debug.ini\"" -S . -B build
make -C build
if [ "${{matrix.coverage}}" = "with-coverage" ]; then
cmake -B build -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install/usr -DDEP_LIB_PATH=${{env.LD_LIBRARY_PATH}} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_C_FLAGS="--coverage -DLOGMILESTONE=ON"
else
cmake -B build -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install/usr -DDEP_LIB_PATH=${{env.LD_LIBRARY_PATH}} -DCMAKE_VERBOSE_MAKEFILE=ON
fi
make -C build
cmake --install build
./build/rdk_logger_gtest
- name: Collect coverage report
if: ${{ matrix.coverage == 'with-coverage' }}
run: |
lcov --directory ${{env.RDKLOGGER_ROOT}}/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${{env.RDKLOGGER_PREFIX}}/*" --output-file coverage.info
- name: Generate the html report
run: |
genhtml coverage.info --output-directory /tmp/coverage_report
- name: Upload coverage report
if: ${{ matrix.coverage == 'with-coverage' }}
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /tmp/coverage_report
20 changes: 20 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "CLA"

permissions:
contents: read
pull-requests: write
actions: write
statuses: write

on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

jobs:
CLA-Lite:
name: "Signature"
uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@v1
secrets:
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT }}
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: Fossid Stateless Diff Scan

on: pull_request
on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: read

jobs:
call-fossid-workflow:
uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@develop
secrets:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@1.0.0
secrets:
FOSSID_CONTAINER_USERNAME: ${{ secrets.FOSSID_CONTAINER_USERNAME }}
FOSSID_CONTAINER_PASSWORD: ${{ secrets.FOSSID_CONTAINER_PASSWORD }}
FOSSID_HOST_USERNAME: ${{ secrets.FOSSID_HOST_USERNAME }}
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v2.4.0](https://github.com/rdkcentral/rdk_logger/compare/v2.3.0...v2.4.0)

- RDKEMW-6710: RDKLogger - Improve L1 Test coverage [`#31`](https://github.com/rdkcentral/rdk_logger/pull/31)
- RDKEMW-9247 : Moving rdklogger_milestone file from .cpp to .c [`#30`](https://github.com/rdkcentral/rdk_logger/pull/30)
- Update CODEOWNERS [`#29`](https://github.com/rdkcentral/rdk_logger/pull/29)
- RDKEMW-8528: Remove logMilestone.sh & use the binary when needed [`#28`](https://github.com/rdkcentral/rdk_logger/pull/28)
- RDKEMW-8798 : Post Code Coverage in the PR workflow [`#27`](https://github.com/rdkcentral/rdk_logger/pull/27)
- Deploy fossid_integration_stateless_diffscan_target_repo action [`#26`](https://github.com/rdkcentral/rdk_logger/pull/26)
- Revert "RDKEMW-8528: Remove logMilestone.sh & use the binary when needed (#28)" [`1daa6b4`](https://github.com/rdkcentral/rdk_logger/commit/1daa6b467a30c30dfaddff4451e3afe3e8290f24)
- Deploy cla action #15 [`761e339`](https://github.com/rdkcentral/rdk_logger/commit/761e3392383d2625f5d58ae2758f9fd31dcd45d3)

#### [v2.3.0](https://github.com/rdkcentral/rdk_logger/compare/v2.2.0...v2.3.0)

> 23 September 2025

- Update Documentation for RDKLogger [`#24`](https://github.com/rdkcentral/rdk_logger/pull/24)
- RDKB-61752 : Add Legacy Function for Backward Compatibility [`#23`](https://github.com/rdkcentral/rdk_logger/pull/23)
- Release of RDKLogger v2.3.0 [`92065f0`](https://github.com/rdkcentral/rdk_logger/commit/92065f0e648feb9fa2f696c77ec88560ae349fbd)

#### [v2.2.0](https://github.com/rdkcentral/rdk_logger/compare/v2.1.0...v2.2.0)

> 8 September 2025

- [RDKC-16005]: RDKLogger OpenSource Migration [`#21`](https://github.com/rdkcentral/rdk_logger/pull/21)
- Release of RDKLogger v2.2.0 [`28d277a`](https://github.com/rdkcentral/rdk_logger/commit/28d277ae00b0f6fdaae1e8c263706efed9651087)

#### [v2.1.0](https://github.com/rdkcentral/rdk_logger/compare/v2.0.0...v2.1.0)

> 1 September 2025

- RDKB-60970: RDKLogger OpenSource Migration [`#20`](https://github.com/rdkcentral/rdk_logger/pull/20)
- Release of RDKLogger v2.1.0 [`a46c1ca`](https://github.com/rdkcentral/rdk_logger/commit/a46c1ca443d2f83ee1fe1b67a5dd7c3c8dc44e45)

#### v2.0.0

> 5 August 2025

- RDKEMW-6709: RDKLogger - Refactoring [`#19`](https://github.com/rdkcentral/rdk_logger/pull/19)
- DELIA-68312: RFC Lock file not deleted after RFC Configuration complete [`#14`](https://github.com/rdkcentral/rdk_logger/pull/14)
- RDKEMW-5034: bcm bb/bbappend analysis for rdk-logger [`#12`](https://github.com/rdkcentral/rdk_logger/pull/12)
- RDKEMW-4586 : Fix for bug Markers not generated [`#11`](https://github.com/rdkcentral/rdk_logger/pull/11)
- RDK-55878 : Converting datapoints to T2 Event [`#10`](https://github.com/rdkcentral/rdk_logger/pull/10)
- RDKEMW-3178: Enable subtec logs with TextTrack activated. [`#9`](https://github.com/rdkcentral/rdk_logger/pull/9)
- RDK-56491: Update debug.ini for nfrtool [`#8`](https://github.com/rdkcentral/rdk_logger/pull/8)
- RDKECMF-178 Fix L1-tests workflow [`#7`](https://github.com/rdkcentral/rdk_logger/pull/7)
- RDK-53334 Integrate RDK logger to Cert Selector library [`#5`](https://github.com/rdkcentral/rdk_logger/pull/5)
- Import of source (develop) [`3accfb1`](https://github.com/rdkcentral/rdk_logger/commit/3accfb141546bc35f25e64d9156c8cbfbf53ba39)
- Remove building cmake from source [`467a8d5`](https://github.com/rdkcentral/rdk_logger/commit/467a8d5d48bb55ead32e4bacd07d1943a7cd1ae1)
- Release of RDKLogger v2.0.0 [`0087a47`](https://github.com/rdkcentral/rdk_logger/commit/0087a47dbc6c28905f7fd4424a43ed1fc8874389)
167 changes: 162 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,165 @@
Overview:
---------
# RDK Logger

The rdklogger is a general-purpose logging mechanism that utilizes log4c for formatting and supports multiple log levels and modules. The log level for each module is read from a configuration file (debug.ini, typically located at /etc/debug.ini) at startup, where log modules and their enabled log levels are defined.
RDK Logger is a general-purpose logging mechanism for RDK components. It supports multiple log levels and modules, with log levels configured via a configuration file (`debug.ini`). Each module can have its own log level, and these can be changed at runtime using the provided CLI utility.

rdklogger supports overriding the configuration at runtime by providing a persistent path to files like /opt/debug.ini or /nvram/debug.ini. It includes a CLI utility called rdklogctrl, which is used to dynamically change log levels for modules at runtime.
## Features

Internally, rdklogger leverages log4c for its formatting, log writing, and log rotation capabilities. One unique feature of rdklogger is that you do not set a single severity level above which no logs with greater severity would be logged. Instead, each level (ERROR, WARN, INFO, DEBUG, etc.) can be independently enabled or disabled. This means you could, for example, disable all ERROR logs while enabling all DEBUG logs.
- Abstracts logging client from underlying logging utility.
- Dynamically enables/disables logging level at run time.
- Provides a structured log format including timestamp, module name, log level, and message.
- Controls log level independently for each component/module.
- Enables logging globally via a single configuration value.
- Controls initial log level for each component/module from configuration file (`debug.ini`) at startup.
- Prints formatted data to stdout or log files.
- Supports separate log files for each module if configured.

## Configuration

Logging levels and modules are configured in `debug.ini`. If a module is not explicitly configured in `debug.ini`, it inherits the log level from `LOG.RDK.DEFAULT`.

See `debug.ini.sample` for an example configuration file.
The sample file includes comments explaining how to set log levels for each module and what each log level enables.

For example:
```
LOG.RDK.DEFAULT=WARNING
LOG.RDK.FOO=DEBUG
LOG.RDK.BAR=NONE
```

- The component `FOO` will print DEBUG, INFO, WARNING, ERROR, and FATAL messages
- The component `BAR` prints `nothing`
- All the other components prints WARNING and higher log levels like ERROR, and FATAL as defined by `DEFAULT`

## Runtime Control

Use the `rdklogctrl` utility to change log levels for modules at run time.

```bash
# Set log level for a module
rdklogctrl <process_name> <module_name> <log_level>

# Examples
rdklogctrl myapp LOG.RDK.NETWORK DEBUG
rdklogctrl receiver LOG.RDK.AUDIO INFO

# Available levels: FATAL, ERROR, WARN, NOTICE, INFO, DEBUG, TRACE, NONE
```

## Quick Start

### 1. Include Headers
```c
#include "rdk_logger.h"
```

### 2. Initialize and Use
```c
int main() {
// Initialize logger
if (RDK_LOGGER_INIT() != RDK_SUCCESS) {
fprintf(stderr, "Failed to initialize RDK Logger\n");
return -1;
}

// Log messages
RDK_LOG(RDK_LOG_INFO, "LOG.RDK.MYAPP", "Application started\n");
RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.MYAPP", "Error: %s\n", strerror(errno));

// Cleanup
rdk_logger_deinit();
return 0;
}
```

### 3. Build and Link
```bash
gcc myapp.c -lrdkloggers -llog4c -lglib-2.0
```

## 📚 Complete Documentation

This repository includes comprehensive documentation for all aspects of RDK Logger:

### 📖 [API Documentation](docs/API_DOCUMENTATION.md)
**Complete developer reference**
- Detailed API function documentation with parameters and return values
- Architecture overview and capabilities
- Configuration system and debug.ini format
- Runtime control mechanisms and utilities
- Performance optimization and best practices
- Complete real-world examples and usage patterns

### ⚡ [Quick Reference](docs/QUICK_REFERENCE.md)
**Essential information for daily use**
- Core function syntax and common patterns
- Log level hierarchy and usage guidelines
- Configuration snippets and examples
- Runtime control commands (rdklogctrl)
- Build system integration examples
- Debugging tips and test programs

### 🔄 [Migration Guide](docs/MIGRATION_GUIDE.md)
**Transitioning from other logging systems**
- Step-by-step migration from printf/fprintf, syslog, and custom logging
- Log level mapping between different systems
- Configuration conversion techniques
- Common migration pitfalls and solutions
- Validation scripts and testing approaches

### 🛠️ [Troubleshooting Guide](docs/TROUBLESHOOTING.md)
**Solutions for common issues**
- Initialization failures and configuration problems
- Missing log output debugging
- Runtime control issues
- Performance and memory problems
- Multi-threading complications
- Build and linking solutions

## 🚀 Getting Started Paths

### For New Users
1. **Read** the [Quick Start](#quick-start) section above
2. **Study** [API Documentation](docs/API_DOCUMENTATION.md) for comprehensive understanding
3. **Reference** [Quick Reference](docs/QUICK_REFERENCE.md) for daily syntax needs

### For Migrating from Other Systems
1. **Identify** your current logging system in [Migration Guide](docs/MIGRATION_GUIDE.md)
2. **Follow** the step-by-step migration process
3. **Validate** using provided migration scripts and tests

### For Troubleshooting
1. **Check** [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for your specific issue
2. **Use** debugging techniques and tools provided
3. **Reference** [Quick Reference](docs/QUICK_REFERENCE.md) for correct syntax

## Log Levels

| Level | When to Use |
|-------|-------------|
| **FATAL** | System crash, unusable |
| **ERROR** | Operation failures |
| **WARN** | Potential problems |
| **NOTICE** | Important events |
| **INFO** | General information |
| **DEBUG** | Debugging details |
| **TRACE** | Function tracing |

## Build Dependencies

- **liblog4c-dev** - Log4C development headers
- **libglib2.0-dev** - GLib development headers
- **autotools** - For building from source

## Repository Structure

```
rdk_logger/
├── include/ # Header files (rdk_logger.h, etc.)
├── src/ # Source files
├── utils/ # Utility programs (rdklogctrl)
├── test/ # Test programs
├── unittests/ # Unit tests
├── debug.ini.sample # Example configuration
└── docs/ # Comprehensive documentation
```
Loading