As $f$ is measurable and $a>1$, the function
$$g(x)=\begin{cases}0&f(x)=0\\a^{\lfloor \log_a|f(x)|\rfloor }&f(x)\ne 0\end{cases}$$
is also measurable: For $c>0$, we have $\mu(g\ge c)=\mu(a^{\lceil \log_ac\rceil }\le |f|)$. And of course $g$ is non-negative.
Note that $$ g(x)\le |f(x)|\le ag(x).$$
Hence if $g$ is integrable then also $\int f\,\mathrm d\mu\le a\int g\,\mathrm d\mu<\infty$ and so $f$ is integrable.
If on the other hand $f$ is integrable, then $\int |f|\,\mathrm d\mu <\infty$ and also $\int g\,\mathrm d\mu\le \int |f|\,\mathrm d\mu<\infty$.
Thus $f$ is integrable iff $g$ is. But
$$\int g\,\mathrm d\mu = \sum_{n\in\Bbb Z}a^n\mu(\{\,a^n\le |f|