For simplicity let's assume that the discount rate $r = 0$, then a price of a call option with strike $K$ and maturity $T$ on an asset with positive price can be computed as $C(K) = \Bbb E_Q(S_T-K)^+$. A known fact that this leads to $C''(K)$ being the density of the risk-neutral distribution $(S_T)_*Q$ of the asset price at maturity. I was playing with this fact to compute first two moments of this distribution for the price itself and its logarithm.
What I got is $\Bbb E_QS_T = C(0)$, that is the forward price, which makes perfect sense. Computations are pretty easy thanks to integration by parts: $$ \Bbb E_QS_T = \int_0^\infty KC''(K)\mathrm dK = \int_0^\infty K\mathrm dC'(K) = \int_0^\infty C'(K) \mathrm dK =C(0) $$ Then I got $\Bbb E_QS^2_T = 2\int_0^\infty C(K) dK$ using the same technique, which does not look natural to me, and in particular I don't see why would that always be greater than $C^2(0)$. Perhaps, monotonicity and concavity guarantees that.
Nevertheless, what I am having problem with is computing $\Bbb E_Q\log S_T$ and $\Bbb E_Q\log^2 S_T$ since if I do integration by parts there, on the very first step I get two terms that are infinite. I do however see $\frac1{K^2}$ starting to appear there, which afaik should be a part of the final result, however I was unable to get the explicit formulas. Can someone help here?