I tried this problem without looking at the answers first. But I came to a different conclusion to the other answers. So I'm posting another answer here.
The answer to the question is
In some cases, some of the logicians will never discover their rank
We can demonstrate this answer using the following reasoning.
To show that the answer is false it suffices to show a single example in which one logician is unable to determine their rank.
We will suppose that there are four logicians: Alice, Bob, Charles and Debbie. Their hats state [1, 2, 4, 5] in order. We suppose that 0 is not a natural number. Note that the second largest number is 4. We claim that Alice cannot deduce her rank regardless of the number of rounds of questioning.
In round 1 none of the logicians will see [1, 2, 3] so all four logicians will answer no.
In round 2, Debbie will see [1, 2, 4]. Since she knows from round 1 that her hat is not 3, she will conclude that it must be larger than 4, so she will answer yes. As explained in Especially Lime's answer the other three logicians will not be able to deduce their rank, and so will reply no. At the end of round 2 all of the logicians will now know, based on Debbie's answer that 4 is the value on the second largest hat.
In round 3 Debbie will still know her rank and will say yes again. Charles cannot see the 4, and so can deduce that he must be wearing it. So he will know he is ranked second and so will say yes. Bob will see [1, 4, 5] and know that his number must be less than 4. So Bob will conclude his hat must be 2 or 3, and in either case his rank must be third. So Bob will also say yes. We will come back to Alice in a little bit.
Now consider a different scenario, in which Alice's hat is 3 not 1, but nothing else is changed. Observe that all four logicians will give the same responses in rounds 1 and 2 as in the previous scenario. In round 3, Debbie and Charles are in the same situation as before and so will also say yes again. For this scenario in round 3 Bob will know that his number is less than 4 and cannot be 3 (since he can see 3). So Bob will know that he must have 1 or 2 and in either case he must be ranked last. So Bob will say yes in round 3.
Now consider Alice's perspective. In both scenarios Alice will see the same hats [2, 4, 5] and in both scenarios the other three logicians will give the same answers in the first three rounds. The other logicians will continue to say yes in every subsequent round. So the two scenarios will look totally identical to Alice and she cannot distinguish them.
But in the first scenario Alice is ranked last and in the second one she is ranked second to last. So Alice will never be able to determine her ranking. She will have to continue to say no for all subsequent rounds.
The flaw in the reasoning given for the other answers is that
The other answers all correctly prove that after sufficient rounds one of the logicians must be able to deduce their rank. But they then assert that by "repeating" or "restarting" the others will eventually be able to deduce their ranks. But the question says that the logicians must answer truthfully. As soon as a logician determines their rank, possibly via a shortcut, then the logician must say yes. Bob has two different ways of immediately determining his status once he knows that '4' is the second largest hat number. But Alice cannot determine which way Bob utilised. If the logicians were only allowed to use the knowledge that Debbie has the highest number, but forgot what number it was then they would eventually be able to deduce all of the rankings.