Show that there exists $\theta\in(a,b)$ such that $\frac{f'(\theta)}{f(\theta)}=\frac{1}{a-\theta}+\frac{1}{b-\theta}.$ 
Question: Let $f:[a,b]\to\mathbb{R}$ be continuous on $[a,b]$, differentiable on $(a,b)$ and let $f(x)\neq 0$ for every $x\in(a,b)$. Show that there exists $\theta\in(a,b)$ such that $$\frac{f'(\theta)}{f(\theta)}=\frac{1}{a-\theta}+\frac{1}{b-\theta}.$$

Solution: Let $g:[a,b]\to\mathbb{R}$ be such that $$g(x)=(a-x)(b-x)f(x), \forall x\in[a,b].$$ Note that $g$ is continuous on $[a,b]$ and differentiable on $(a,b)$ with $$g'(x)=-(b-x)f(x)-(a-x)f(x)+(a-x)(b-x)f'(x)\\=(a-x)(b-x)f'(x)-f(x)((a-x)+(b-x)), \forall x\in(a,b).$$
Now note that $g(a)=g(b)=0$. Thus, by applying Rolle's theorem to $g$ on the interval $[a,b]$, we can conclude that $\exists \theta\in(a,b)$ such that $g'(\theta)=0$, that is $$(a-\theta)(b-\theta)f'(\theta)-f(\theta)((a-\theta)+(b-\theta))=0\\\implies \frac{f'(\theta)}{f(\theta)}=\frac{1}{a-\theta}+\frac{1}{b-\theta}.$$ Hence, we are done.
Is this solution correct and rigorous enough and is there any other alternative way to solve the problem?

There's a stronger result we can state here: Let $f$ be bounded, differentiable, and nonzero on $(a,b).$ Let $g$ be continuous on $[a,b],$ differentiable and nonzero on $(a,b),$ with $g(a)=0=g(b).$ Then
$$\tag 1 \frac{f'(c)}{f(c)} + \frac{g'(c)}{g(c)} =0$$
for some $c\in (a,b).$
If we let $g(x)=(x-a)(b-x),$ $(1)$ implies the conclusion of the specific problem we started with, even if $f(x)$ is crazy like $2+\sin(1/(x-a)).$
The proof uses the same ideas as you did, but it might actually be easier. Define $h(x)=f(x)g(x).$ Then $h$ is differentiable on $(a,b).$ Note that because $f$ is bounded, $h(x)\to 0$ at the end points because of our assumption on $g.$ Thus we can regard $h$ as continuous on $[a,b]$ with $h(a)=0=h(b).$ By Rolle, $h'(c)= 0$ for some $c\in (a,b).$ That means
$$f'(c)g(c) + f(c)g'(c) = 0.$$
Now divide by $f(c)g(c)$ to get $(1)$
