If we integrate by parts, where u=x (du=dx) and dv=tan(x)dx (v=ln|sec(x)|, we get:
xln|sec(x)|+∫ln|cos(x)|dx.
The integral here can only be evaluated as a series (Taylor/Maclaurin).
Let y(x)=∑anxn=ln|cos(x)|, then y(0)=a0=ln|cos(0)|=0; let t=tan(x) for convenience and brevity. When x=0, t=0. The summation starts at n=0.
Whenever we differentiate t wrt x, we get 1+t2 in the derivative.
The rth derivative of y is represented by y(r), so y'=dy/dx=y(1).
y(1)(x)=∑nanxn-1, for n≥1, so the first term is constant a1; y(1)(x)=-tan(x)=-t; y(1)(0)=0, making a1=0.
With each derivative n≥r for the rth derivative. The first term (constant) is r!ar. All other terms vanish when x=0.
y(2)(x)=∑n(n-1)anxn-2=-sec2(x)=-(t2+1); y(2)(0)=2!a2=-1, a2=-½.
y(3)(x)=∑n(n-1)(n-2)anxn-3=-2sec2(x)tan(x)=-2t(t2+1)=-2t3-2t; y(3)(0)=3!a3=0.
y(4)(x)=-6t2(t2+1)-2(t2+1)=-6t4-8t2-2, a4=-2/4!=-1/12.
y(5)(x)=-(24t3+16t)(t2+1)=-24t5-40t3-16t, a5=0.
y(6)(x)=-(120t4+120t2+16)(t2+1)=-120t6-240t4-136t2-16, a6=-16/6!=-1/45.
a2k+1=0. Further derivatives and coefficients a2k can be found.
However, it remains to perform integration of this series.
∫∑anxndx=∑anxn+1/(n+1). a0=a2k+1=0, a2=-½, a4=-1/12, a6=-1/45.
∫ln|cos(x)|dx=-x3/6-x5/60-x7/315-...
∫xtan(x)dx=xln|sec(x)|-x3/6-x5/60-x7/315-...+C.