Evaluate definite integral $\int_0^{e^{\pi}} |\cos\ (\ln x)|dx$ 
Evaluate
$$ \int_0^{e^{\pi}} |\cos\ (\ln x)|dx$$

My ideas: I substituted $u = \ln x$ and tried to evaluate
$$\int_{-\infty}^\pi |\cos u|\ e^u du$$
Integration by parts didn't yield any results however. Does anybody have another idea?
 A: Here's a solution based on GEdgar's hint.
$$\begin{aligned}
\int_0^{e^{\pi}} |\cos (\ln x) |\; dx &= \int_{-\infty}^{\pi} |\cos u |\; e^u \; du\\
&= \int_{\pi/2}^{\pi} |\cos u |\; e^u \; du +\sum_{k = 0}^{\infty} \int_{-k\pi -\pi/2}^{-k\pi +\pi/2} |\cos u |\; e^u \; du \\
&= \left| \int_{\pi/2}^{\pi} \cos u \; e^u \; du \right| +\sum_{k= 0}^{\infty} \left|\int_{-k\pi -\pi/2}^{-k\pi +\pi/2} \cos u \; e^u \; du\ \right| \\
&= \left|\ \left[ \frac12(\sin u+\cos u) \; e^u \right]
_{\pi/2}^{\pi}\
\right|
+
\sum_{k= 0}^{\infty}
\left|\
\left[
\frac12(\sin u+\cos u) \; e^u
\right]
_{-k\pi -\pi/2}^{-k\pi +\pi/2}\
\right|
\\
&=
\frac 12e^\pi
+
2
\sum_{k=0}^{\infty}
\frac 12 e^{-k\pi +\pi/2}
\\
&=
\frac 12e^\pi
+
e^{\pi/2}
\cdot
\frac 1{1-e^{-\pi}}\ .
\end{aligned}$$
A: $$I=\int_{0}^{e^{\pi}}|\cos (\ln x)| dx= -\int_{-\infty} ^{\pi} e^t~ |\cos t| dt$$
$$\implies I=-\int_{-\infty}^{0} e^{t} |\cos t|~ dt-\int_{0}^{\pi/2} e^{t} \cos t ~dt+\int_{\pi/2}^{\pi} e^{t} \cos t~ dt$$
$$\implies I=\int_{0}^{\infty} e^{-t} |\cos t|~ dt-\int_{0}^{\pi/2} e^{t} \cos t ~dt+\int_{\pi/2}^{\pi} e^{t} \cos t~ dt$$
Let $$J=\int_{0}^{\infty} e^{-t} |\cos t| ~dt = \lim_{n \rightarrow \infty} \int_{0}^{n\pi} e^{-t} |\cos t| dt =[(1+e^{-\pi}+e^{-2\pi}+e^{-3\pi}+....+e^{-n\pi}] K$$ $$\implies J=\frac{K}{1-e^{-\pi}}$$ 
Because the period of $|\cos t|$ is $\pi$, so in above we have broken in sections $[0,\pi], [\pi, 2\pi],[2\pi, 3\pi],.....[(n-1)\pi,  \pi]$. Here $K=\int_{0}^{\pi} e^{-t} |\cos t| dt$
$$\implies I=J-\int_{0}^{\pi/2} e^{t} \cos t ~dt+\int_{\pi/2}^{\pi} e^{t} \cos t~ dt$$
by integration by part we have,
$$\int e^{t} \cos t dt =\frac{1}{2} e^{t} [\cos t+ \sin t]~~~~(*)$$
$$I=J-\frac{1}{2}[e^{\pi}+2e^{\pi/2}-1]$$
Using (*)
$$K=\frac{1}{2}(1-e^{-\pi}+2 e^{-\pi/2})$$
So we finally get 
$$I=\frac{e^{\pi}-1+2e^{\pi/2}}{2(e^{\pi}-1)}+\frac{e^{\pi}+2e^{\pi/2}-1}{2}=\frac{e^{\pi}(e^{\pi}-1+2e^{\pi/2})}{2(e^{\pi}-1)}$$
