We all know that
$$\log\left(\frac{A}{B}\right) = \log(A)-\log(B)$$
However, in the case where $A$ and $B$ have (identical) units, such as kilograms, the right-hand side cannot be performed because the arguments are not dimensionless. How can one rationalize this observation without making the circular argument to convert the right-hand side back to the left-hand side when you have units?
Treat the unit like a variable:
$$\log\left(\dfrac{A \cdot kg}{B \cdot kg}\right) = \log(A) + \log(kg) - \log(B) - \log(kg) = \log(A) - \log(B)$$
After all, that's what you're doing when you say the units cancel.