kong icon indicating copy to clipboard operation
kong copied to clipboard

Log message does not match plugin

Open fairyqb opened this issue 4 months ago • 9 comments

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

fairyqb avatar Feb 27 '24 04:02 fairyqb

hi @fairyqb could you give us the detailed steps to reproduce?

chobits avatar Mar 04 '24 08:03 chobits

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.

fairyqb avatar Mar 11 '24 02:03 fairyqb

Hi @fairyqb , we can not re-produce this issue in our environment, could you give us more details? thanks.

chronolaw avatar Mar 18 '24 07:03 chronolaw

@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.

StarlightIbuki avatar Mar 19 '24 07:03 StarlightIbuki

@ADD-SP I feel this could be solved by an enhancement of the timer library. What do you think?

StarlightIbuki avatar Mar 25 '24 08:03 StarlightIbuki

This issue is marked as stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Apr 09 '24 01:04 github-actions[bot]

@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.

ADD-SP avatar Apr 09 '24 02:04 ADD-SP

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

chobits avatar Apr 15 '24 07:04 chobits

This issue is marked as stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Apr 30 '24 01:04 github-actions[bot]

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

github-actions[bot] avatar May 07 '24 01:05 github-actions[bot]