The reason for this is to avoid ambiguity (as discussed in comments). Both are acceptable, and neither are incorrect as long as we are careful.
The ambiguity appears when the writer fails to parenthesise the argument of the function. For example, compare the following choices of notation: $$ \log x^3 \quad \log (x)^3 \quad \log ^3 x$$
All $3$ of the above could be used to mean $( \log (x))^3$. However, whether or not they should is another question.
The first choice of notation is unclear and could also be interpreted as $\log (x^3)$
The second is clear, however, there is still some room for ambiguity - particularly if we replace $x$ with some function of $x$, for example $ \log (x+3) ^3$ is now a bit more vague as to whether or not it is referring to $\log \big{(} (x+3)^3 \big{)}$ or $\big{(} \log (x+3) \big{)}^3$
The third notation is the clearest. There is no room for misinterpretation here. When we write $\log ^3 ( \cdot \cdot \cdot )$ this unambiguously means that the entire function is being cubed as opposed to just the input.
With that being said, the second notation is also very common and is generally considered to be perfectly fine notation as long as you are clear with your use of parentheses to avoid any ambiguity that may arise (as given in some of the examples above).
The first choice of notation is not especially uncommon, although I would advise against it in most cases. The lack of parentheses makes it vague and the only scenarios in which I would say this is fine are when the argument of the logarithm is a single number or variable that is not being raised to a power (e.g. $\log 2$ or $\log x$ are clear and don't need to incorporate parentheses to avoid any ambiguity).