I think it's fine to retry indefinitely, but it shouldn't log indefinitely.  I prefer to log the error once and then log the successful connection event once.  It isn't useful to have repeated error messages in the log, but it is useful to have the program reconnect automatically and without limit.