Evaluate $\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2} dx$ integrating around keyhole contour The idea is to prove the following by integrating $f(z)=\frac{z^a\log(z)}{z^2+b^2}$ around the contour of the figure.
$$\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2} dx = \frac{\pi b^{a-1}}{2\cos^2(\pi a/2)}\Bigg[\frac{\pi}{2}\sin\Big(\frac{\pi a}{2}\Big)+\log(b)\cos\Big(\frac{\pi a}{2}\Big)  \Bigg], -1<a<1; b>0$$

My try:
$$\operatorname{Res}[f(z),ib]=\frac{e^{i\pi a /2}}{2i}b^{a-1}\big(\log(b)+i\frac{\pi}{2}\big)$$
$$\operatorname{Res}[f(z),-ib]=-\frac{e^{i3\pi a /2}}{2i}b^{a-1}\big(\log(b)+i\frac{3\pi}{2}\big)$$
I already proved that both $\int_{C_r}$ and $\int_{C_R}$ $\rightarrow 0$ as $r\rightarrow 0$ and $R\rightarrow \infty$ respectively.
Then I came up with
$$\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2}dx-e^{i2\pi a}\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2}dx -i2\pi e^{i2\pi a}\int_{0}^{\infty}\frac{x^a}{x^2+b^2} dx =2\pi i \sum\operatorname{Res} $$
And using a previous result from another exercise:
$$\int_{0}^{\infty}\frac{x^a}{x^2+b^2} dx=\frac{\pi b^{a-1}}{2\cos(\pi a/2)}$$
I've got the following not-so-friendly expression that has kept me in check for a while trying to simplify it:
$$\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2} dx-e^{i2\pi a}\int_{0}^{\infty}\frac{x^a \log(x)}{x^2+b^2} dx-i2\pi e^{i2\pi a}\frac{\pi b^{a-1}}{2\cos(\pi a/2)}=2\pi i \Big(\frac{e^{i\pi a /2}}{2i}b^{a-1}\big(\log(b)+i\frac{\pi}{2}\big)-\frac{e^{i3\pi a /2}}{2i}b^{a-1}\big(\log(b)+i\frac{3\pi}{2}\big)\Big) $$
So my question is, am I forgeting something real trivial here? a step that would make my solution flow smoother from what I already got? Am I overcomplicating myself somewhere? Considering that the problem is meant to be solved with the given keyhole contour (I already tried using a semicircular contour instead), any sugestion or some insight will be appreciated.

Exercise 9, section 4.5 from William R. Derrick, Complex Analysis and Applications.
 A: After giving this problem another try with a semicircular contour (again ☺) I finally got a valid result using residues (I also did the differentiation respect to $a$ that user10354138 mentioned, but the idea was initially solving it by using residues). So I'm posting it here for future reference and searchers.

Considering the semicircular contour of the figure, we integrate $f(z)=\frac{z^a log(z)}{z^2+b^2}$ considering the pole $z=ib$ is inside the contour.

Then:
$$\oint_C f(z)dz= 2\pi i \operatorname{Res}[f(z),ib]=2\pi i\frac{e^{i\pi a /2}}{2i}b^{a-1}\big(\log(b)+i\frac{\pi}{2}\big)=\pi e^{i\pi a /2}b^{a-1}\big(\log(b)+i\frac{\pi}{2}\big)$$
Where
$$\oint_C f(z)dz=\int_{C_1} + \int_{C_2} + \int_{C_r} + \int_{C_R}$$
It's easy to prove that $\int_{C_r} \rightarrow 0$ and $\int_{C_R} \rightarrow 0$ as $r \rightarrow 0$ and $R \rightarrow \infty$ respectively. Then, considering the segments $C_1$ and $C_2$ we have the following.
At $C_1: z=x$ with $r<x<R$ and $dz=dx$ then:
$$\int_{C_1} = \int_r^R \frac{x^a \log(x)}{x^2+b^2} dx$$
At $C_2: z=xe^{i\pi}$ with $r<x<R$ and $dz=dxe^{i\pi}=-dx$ then:
$$\int_{C_2} = \int_R^r \frac{(xe^{i\pi})^a \log(xe^{i\pi})}{x^2+b^2} (-dx) = e^{i\pi a}\int_r^R \frac{x^a (\log(x)+i\pi)}{x^2+b^2} dx$$
Then we can write the contour integral as ($\lim\limits_{\begin{smallmatrix} r \to 0 & \\ R\to \infty \end{smallmatrix}}$):
$$\oint_{C} = (1+e^{i\pi a})\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx +
i\pi e^{i\pi a} \underbrace{\int_0^\infty \frac{x^a}{x^2+b^2} dx }_{\frac{\pi b^{a-1}}{2\cos(\pi a/2)}}= \pi b^{a-1} e^{i\pi a /2}\big(\log(b)+i\frac{\pi}{2}\big)$$
Dividing by $e^{i\pi a /2}$ both sides:
$$\underbrace{e^{-i\pi a /2}(1+e^{i\pi a})}_{2\cos(\pi a/2)}\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx +
i\pi e^{i\pi a} e^{-i\pi a /2}\frac{\pi b^{a-1}}{2\cos(\pi a/2)}= \pi b^{a-1}\big(\log(b)+i\frac{\pi}{2}\big)$$
$$2\cos(\pi a/2)\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx +
i e^{i\pi a /2}\frac{\pi^2 b^{a-1}}{2\cos(\pi a/2)}= \pi b^{a-1} \big(\log(b)+i\frac{\pi}{2}\big)$$
After a little of algebraic manipulation we have:
$$\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx = \frac{1}{2\cos(\pi a/2)} \Big[\pi b^{a-1}\Big( \log(b) +i\frac{\pi}{2}\Big) - \frac{i\pi^2 b^{a-1}}{2} + \frac{\pi^2 b^{a-1}}{2}\tan(\pi a/2)   \Big]$$
After factorizing $\pi b^{a-1}$, canceling $i\frac{\pi}{2}$ and $-i\frac{\pi}{2}$ we have:
$$\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx = \frac{\pi b^{a-1}}{2\cos(\pi a/2)} \Big[\log(b) + \frac{\pi}{2}\frac{\sin(\pi a/2)}{\cos(\pi a/2)}   \Big]$$
$$\int_0^\infty \frac{x^a \log(x)}{x^2+b^2} dx = \frac{\pi b^{a-1}}{2\cos^2(\pi a/2)} \Big[\log(b)\cos(\frac{\pi a}{2}) + \frac{\pi}{2}\sin(\frac{\pi a}{2})  \Big]$$
which is the desired result.
