Sometimes, messages are logged multiple times.
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.