Let $\displaystyle I = \int_{0}^{\frac{\pi}{4}}\frac{1-\tan x}{1+\tan x}dx = \int_{0}^{\frac{\pi}{4}}\frac{\cos x-\sin x}{\cos x+\sin x}dx$
Now put $\cos x+\sin x=t\;,$ Then $\left(-\sin x+\cos x\right)dx = dt$ and changing limit
So we get $\displaystyle I = \int_{1}^{\sqrt{2}}\frac{1}{t}dt = \left[\ln t\right] = \ln(\sqrt{2}) = \frac{\ln 2}{2}$