Skip to content
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

Duplicate log messages #2

Closed
wheelercj opened this issue Jan 17, 2024 · 0 comments
Closed

Duplicate log messages #2

wheelercj opened this issue Jan 17, 2024 · 0 comments
Assignees

Comments

@wheelercj
Copy link
Owner

Sometimes, messages are logged multiple times.

Example:

2023-12-16 07:38:31[INFO]Loading . . .
2023-12-16 07:39:00[INFO][author chris__________][guild None][command remind]
2023-12-16 07:55:01[INFO][author chris__________][guild None][command /remind list]
2023-12-16 07:55:10[INFO][author chris__________][guild None][command /remind delete]
2023-12-17 20:38:51[INFO]Loading . . .
2023-12-17 20:38:51[INFO]Loading . . .
2023-12-18 05:03:03[INFO][author chris__________][guild None][command /timestamp]
2023-12-18 05:03:03[INFO][author chris__________][guild None][command /timestamp]
2023-12-18 05:03:56[INFO][author chris__________][guild None][command /timestamp]
2023-12-18 05:03:56[INFO][author chris__________][guild None][command /timestamp]
2023-12-20 06:43:21[INFO][author chris__________][guild None][command /translate to]
2023-12-20 06:43:21[INFO][author chris__________][guild None][command /translate to]
2023-12-20 10:09:59[INFO]Loading . . .
2023-12-20 10:09:59[INFO]Loading . . .
2023-12-20 10:09:59[INFO]Loading . . .
2023-12-21 06:49:51[INFO][author chris__________][guild None][command /timestamp]
2023-12-21 06:49:51[INFO][author chris__________][guild None][command /timestamp]
2023-12-21 06:49:51[INFO][author chris__________][guild None][command /timestamp]
2023-12-21 06:50:14[INFO][author chris__________][guild None][command /timestamp]
2023-12-21 06:50:14[INFO][author chris__________][guild None][command /timestamp]
2023-12-21 06:50:14[INFO][author chris__________][guild None][command /timestamp]

Notice the time of each line. Some lines have the same time as other lines, which doesn't make sense since all commands here were from one person, unless individual events are being logged multiple times.

The patterns in the log files suggest that when the bot reconnects, the logger is sometimes recreated but doesn't actually replace the existing logger even though the variable is overwritten.

It appears the discord.py documentation has changed slightly since I last read about on_connect. It now says that the warnings from on_ready also apply; that is, the on_connect function may be called multiple times during a single run of the bot.

@wheelercj wheelercj self-assigned this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant