While testing, they absolutely do affect performance. I have found that it is untenable to have more than 100 debug messages printed per step, at least if you want to have a smooth 60 FPS. (This was an estimate – I don't have GMS2 open right now for testing). From my experience with other programming languages, I suspect the limiting factor is GMS2 rerendering the console after a new message is printed to it. When releasing the game, this bottleneck should no longer exist.
In a release version, it is extremely unlikely that they affect performance.
If debug logging becomes a limitation while testing (unlikely – a mere 10 seconds would accumulate more than 5,000 messages for you as a debugger to go through), then you may wish to consider putting debug output into a buffer, and outputting the buffer's contents every frame.
All of that aside, debugging takes a long time, and debug messages are a real lifesaver when debugging. Do not worry about performance issues from debug logging – it's simple enough to [CTRL]+[SHIFT]+[F] and remove all the debug logging code after debugging.
TL;DR: Debug logging does affect performance while testing, is unlikely to affect performance when releasing it (building a final executable), and definitely doesn't affect performance if you delete it all. There are also ways to speed it up. However, the performance loss from debug logging is more than made up by your own gain in programming and debugging performance, so don't worry about logging too much stuff.