Is it a problem that you can write the logarithm of a quantity with units? While working out something in thermodynamics, I encountered an equation that had a term like $\log(n_1/n_2)$, where, $n_1$ and $n_2$ are the number densities. Now of course the argument of the $\log$ is dimensionless, but I can write the same as (at least mathematically) $\log(n_1)-\log(n_2)$, in which case we have inconsistency that the arguments are not dimensionless. 
So even though, its mathematically possible, in the case of physics should we restrict from using this particular expression for $\log$ wherever we have some inconsistency?
EDIT : As it has been pointed out in comments, I am also interested in understanding in cases, where $n2$ or $n1$ is small since one can't use a series expansion !!
 A: As you said $\log(n_1/n_2)$ is perfectly valid because even though $n_1$ and $n_2$ are not individually dimensionless but their ratio is dimensionless. 
The relation
$$\log(a/b) = \log(a) - \log(b)$$
is only true if $a$ and $b$ are real positive numbers. Since $n_1$ and $n_2$ are not real positive numbers (they are quantities with dimensions), you can't expand $\log(n_1/n_2)$ as $\log(n_1) - \log(n_2)$. It's similar to how you can't write $\log(-2/-5) = \log(-2) - \log(-5)$.
Let's say $n_1 = N_1 \, \text{units}$ and $n_2 = N_2 \, \text{units}$, where $N_1$ and $N_2$ are dimensionless real positive numbers. Then $n_1/n_2 = N_1/N_2$, and now
$$\log(n_1/n_2) = \log(N_1/N_2) = \log(N_1) - \log(N_2) \, .$$
This expression is both mathematically and physically valid and makes sense. :)
A: It's valid, but in physics it is usually safer that each partial term keeps some physical meaning (and physical consistency). At any point you can temporally "leave physics for maths": calculations are equivalent, at your own risk of mistake ! (e.g. if you start identifying terms with similar-looking terms coming from other sources). It might happen also that some indeterminations, infinites, complexs come on the way in partial terms, as in maths, but with little possibility to interpret them. Comprising knowledge of what is neglectable or not, linearizable or not (is the parameter "small" in $exp(-10^{-5}~ \rm{parsecs})$ ? :-) ).
