It may be inconvenient, but it is not wrong. An imaginary-valued function can very well have a real derivative. For example
In[22]:= D[Log[-t^2], t]
Out[22]= 2/t
If you insist on a real-valued primitive, here is a trick:
In[23]:= D[1/2 Log[(-t^2)^2], t]
Out[23]= 2/t
You may also introduce Abs
or RealAbs
into the formulas with logarithms.