solnlib is using root logger to log things
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend, observability-sre
Research direction
Start by comparing logging in solnlib/timer_queue.py with the module logger pattern in urllib3, then inspect the error path in solnlib/rest.py. The issue requires deciding which messages should reach Splunkd and whether changing logger behavior affects callers. Done means an agreed, consistent logging policy is applied without suppressing necessary errors or introducing an unintended breaking change.
Written by the indexing model from the issue text.
Description
Issue Description:
I think the main issue is that any INFO or DEBUG logs in solnlib are going into Splunkd as ERROR logs.
I think the logging currently is not as per best practice. Currently it uses logging.info , which puts logs in splunkd. : https://github.com/splunk/addonfactory-solutions-library-python/blob/develop/solnlib/timer_queue.py#L234
I think the best practice should be to initialize a logger for the module and not using logging.info directly. That is how I have seen other third party libraries doing. For Example urllib3 that requests uses : https://github.com/urllib3/urllib3/blob/main/src/urllib3/connectionpool.py#L61
Other notes :
I was trying to do the same thing in solnlib like urllib3 but I see that in certain places it can cause issue like this : https://github.com/splunk/addonfactory-solutions-library-python/blob/develop/solnlib/rest.py#L67
Here the error is the only way someone can know that something went wrong cause we are not raising an exception. If we turn off this logger by default, it will suppress necessary information and if we raise an error from here, it would mean a breaking change for someone using this method.
Also, there are certain places where somone can argue that error should go into splunkd. Thus, we might need to make a decision on this behaviour of solnlib.
Slack Conversation with example logs : https://splunk.slack.com/archives/C03T8QCHBTJ/p1748939756182799
- Dominant language
- Python
- Stars
- 18
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from splunk/addonfactory-solutions-library-python
-
splunk/addonfactory-solutions-library-python#420 · 4 comments · 1 assignee ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
splunk/addonfactory-solutions-library-python#334 · 6 comments ·
-
bug
splunk/addonfactory-solutions-library-python#311 · 2 comments · 1 assignee ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
All issues in splunk/addonfactory-solutions-library-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100