I have already solved the problem but would appreciate a clarification in part (b).
A has initial wealth $w$ and faces a loss $l$ with known probability $\pi$. Insurance available at unit price $\rho$ will provide unit compensation $1$ if the loss occurs. (Assume that 0 < $\pi$; $\rho$ < 1) Denote by $x$ the quantity of insurance purchased, and suppose that this quantity can be no smaller than $0$ (no insurance) and no larger than $l$ (full insurance). Write $u(.)$ for A's utility index function over money lotteries.
(a) Express A's utility as a function of the choice variable $x$ and the parameters $w, l, \pi$, and $\rho$.
My answer:

(b) Suppose that $u(z) = log z$.
If $\rho = \pi$ , what will be A's demand for insurance? How will this demand change if instead $\rho >\pi$? $\:$ If $\rho < \pi$?
My question: I'm not too sure what bearing $u(z)=log(z)$ has on the actual problem, could anyone explain?
This is what I did (FOC for optimality) :

As it turns out, my answer for (b) is correct. If I remember correctly $u(z)=log(z)$ should represent a risk averse function. However, I still don't understand what role $u(z)=log(z)$ is supposed to play in part (b) as I achieved the correct answer by coincidence.
$$\:$$ I.e. I treated $u(z)=log(z)$ as $u(x)=log(x)$ and just went about finding the FOC for $U(x)$.
Your FOC is wrong if the utility is different than $u(z)=\log(z)$. For example, consider $$u(x)=\sqrt{x}$$ then your FOC is: $$\frac{\partial}{\partial x}U(x)=\frac{\pi (1-p)}{2\sqrt{w-\ell+x(1-p)}}-\frac{(1-\pi)p}{2\sqrt{w-px}}=0$$
Your FOC makes sense only if $u^\prime(x)=\frac 1x$.