[tex]\ln(3x)^2=2\ln(3x)[/tex]
Take [tex]y=3x[/tex], so that [tex]\dfrac{\mathrm dy}3=\mathrm dx[/tex], and you have
[tex]\displaystyle\int\ln(3x)^2\,\mathrm dx=\frac23\int\ln y\,\mathrm dy[/tex]
Integrate by parts, setting [tex]u=\ln y[/tex] and [tex]\mathrm dv=\mathrm dy[/tex], which give [tex]\mathrm du=\dfrac{\mathrm dy}y[/tex] and [tex]v=y[/tex]. Then
[tex]\displaystyle\frac23\int\ln y\,\mathrm dy=\frac23\left(y\ln y-\int\frac yy\,\mathrm dy\right)=\frac23y\ln y-\frac23y+C[/tex]
which in terms of [tex]x[/tex] is
[tex]\displaystyle\frac23y\ln (3x)-\frac23(3x)+C[/tex]
[tex]\displaystyle\frac23y\ln x-2x+C[/tex]
where the last term uses the property that [tex]\ln(ab)=\ln a+\ln b[/tex], and the [tex]\dfrac23\ln3[/tex] term is absorbed into [tex]C[/tex].