# How to derive the dynamic of the log forward price?

I have the following Schwartz model: $$dS_t=a(\mu-\ln S_t)S_tdt+\sigma S_tdW_t$$ $$X_t=\ln S_t$$ $$dX_t=a(\hat{\mu}-X_t)dt+\sigma dW_t$$ with $\hat{\mu}=\mu-\frac{\sigma^2}{2a}\sigma$ $$F_t(T)= \exp\left(e^{-a(T-t)}X_t+\hat{\mu}(1-e^{-a(T-t)})+\frac{\sigma^2}{4a}(1-e^{-2a(T-t)})\right)$$ and I want to derive the value of $d \ln F(t,T)$

I do the following:

Let $Y_t=\ln F(t,T)$

Then $dY=\frac{dF}{F}-\frac{1}{2}\frac{<dF,dF>}{F^2}$

We have $\frac{dF}{F}=e^{-a(T-t)} dX_t=e^{-a(T-t)}\left(a(\hat{\mu}-\ln S_t)dt+\sigma dW_t\right)$

and $\frac{<dF,dF>}{F^2}= e^{-2a(T-t)}\sigma^2dt$

So that $d\ln F(t,T)=e^{-a(T-t)}\left(a(\hat{\mu}-\ln S_t)dt+\sigma dW_t\right)-\frac{1}{2}e^{-2a(T-t)}\sigma^2dt$

However I believe that this is wrong as the answer given in correction is: $$d\ln F(t,T) = e^{-a(T-t)}\sigma dW_t-\frac{1}{2}e^{-2a(T-t)}\sigma^2dt$$

This means that there is probably a mistake in my $\frac{dF}{F}$, can you help me?

There might be a misuse of your notations. You had better define another $g=g(t,x;T)$, where $t$ and $x$ are unknowns of $g$, while $T$ is some auxiliary parameter, such that $F_t(T)=g(t,X_t;T)$. The notation $F_t(T)$ appears somewhat confusing, because you might ignore the fact that it is also a function of $t$.
Therefore, define $$g(t,x;T)=\exp\left(e^{-a\left(T-t\right)}x+\hat{\mu}\left(1-e^{-a\left(T-t\right)}\right)+\frac{\sigma^2}{4a}\left(1-e^{-2a\left(T-t\right)}\right)\right),$$ and it is obvious that $$F_t(T)=g(t,X_t;T).$$
Now, note that $$Y_t=\log F_t(T)=\log\left(g(t,X_t;T)\right)=\left(\log\circ g\right)(t,X_t;T),$$ where the composite function $\log\circ g$ depends on both $t$ and $x$. Thus It's formula should be $${\rm d}Y_t=\frac{\partial\left(\log\circ g\right)}{\partial t}(t,X_t;T){\rm d}t+\frac{\partial\left(\log\circ g\right)}{\partial x}(t,X_t;T){\rm d}X_t+\frac{1}{2}\frac{\partial^2\left(\log\circ g\right)}{\partial x^2}(t,X_t;T){\rm d}\left<X\right>_t.$$ It seems that you have left out the $$\frac{\partial\left(\log\circ g\right)}{\partial t}(t,X_t;T){\rm d}t$$ term.
By the way, I am wondering why you chose to deal with $F_t(T)$ directly. Note that $$\log F_t(T)=e^{-a\left(T-t\right)}X_t+\hat{\mu}\left(1-e^{-a\left(T-t\right)}\right)+\frac{\sigma^2}{4a}\left(1-e^{-2a\left(T-t\right)}\right).$$ If you choose to define $$Z_t=\log F_t(T)=e^{-a\left(T-t\right)}X_t+\hat{\mu}\left(1-e^{-a\left(T-t\right)}\right)+\frac{\sigma^2}{4a}\left(1-e^{-2a\left(T-t\right)}\right),$$ then $${\rm d}\log F_t(T)={\rm d}Z_t={\rm d}\left(e^{-a\left(T-t\right)}X_t+\hat{\mu}\left(1-e^{-a\left(T-t\right)}\right)+\frac{\sigma^2}{4a}\left(1-e^{-2a\left(T-t\right)}\right)\right),$$ which is much easier to deal with.