kong
kong copied to clipboard
Log message does not match plugin
Is there an existing issue for this?
- [X] I have searched the existing issues
Kong version ($ kong version
)
kong version all
Current Behavior
The plug-in log message shows that it is plug-in my-plugin-1, but actually this message belongs to plug-in my-plugin-2.
/usr/local/kong/logs/error.log 2024/02/27 11:50:18 [error] 111733#0: *35 [kong] handler.lua:232 [my-plugin-1] initialize cache., context: ngx.timer
Expected Behavior
actually this message belongs to plug-in my-plugin-2.
Steps To Reproduce
kong.log.err("initialize cache.") in plug-in my-plugin-2.
Anything else?
No response
hi @fairyqb could you give us the detailed steps to reproduce?
kong.log.err in the plug-in to record logs. There are multiple plug-ins in the production environment, which cannot be easily reproduced. Occasionally, the log records in the log file are disordered.
Hi @fairyqb , we can not re-produce this issue in our environment, could you give us more details? thanks.
@fairyqb I guess you are logging in a timer? Or even in the log phase handler? Due to a limitation of the current implementation of kong.log, it sometimes messes up the namespace after yielding into a timer.
@ADD-SP I feel this could be solved by an enhancement of the timer library. What do you think?
This issue is marked as stale because it has been open for 14 days with no activity.
@ADD-SP I feel this could be solved by an enhancement of the timer library. What do you think?
@StarlightIbuki The timer-ng was not designed for solving issues not associated with timing tasks.
As I discussed with @StarlightIbuki offline, there might not be an easy way to resolve this issue. Since it’s a minor problem that doesn’t affect kong’s operation, we may not address it at the moment. We need to find an effective method to pass the plugin name to its created timer.
Associated code line: https://github.com/Kong/kong-ee/blob/3e1dab321151c0c5e3c0e38dcd4370aad4a875a4/kong/runloop/plugins_iterator.lua#L625
Internal issue: KAG-4252
This issue is marked as stale because it has been open for 14 days with no activity.
Dear contributor,
We are automatically closing this issue because it has not seen any activity for three weeks. We're sorry that your issue could not be resolved. If any new information comes up that could help resolving it, please feel free to reopen it.
Your contribution is greatly appreciated!
Please have a look our pledge to the community for more information.
Sincerely, Your Kong Gateway team