  The $n$-vector spin model, which includes the self-avoiding walk (SAW) as a
special case for the $n \rightarrow 0 $ limit, has an upper critical
dimensionality at four spatial dimensions (4D). We simulate the SAW on 4D
hypercubic lattices with periodic boundary conditions (PBCs) by an irreversible
Berretti-Sokal algorithm up to linear size $L=768$. From an unwrapped
end-to-end distance, we obtain the critical fugacity as $z_c= 0.147 \, 622 \,
380(2)$, improving over the existing result $z_c=0.147 \, 622 \, 3(1)$ by 50
times. Such a precisely estimated critical point enables us to perform a
systematic study of the finite-size scaling of 4D SAW for various quantities.
Our data indicate that near $z_c$, the scaling behavior of the free energy
simultaneously contains a scaling term from the Gaussian fixed point and the
other accounting for multiplicative logarithmic corrections. In particular, it
is clearly observed that the critical magnetic susceptibility and the specific
heat logarithmically diverge as $\chi \sim L^2 (\ln L)^{2 \hat{y}_h}$ and $C
\sim (\ln L)^{2 \hat{y}_t}$, and the logarithmic exponents are determined as
$\hat{y}_h=0.252(2)$ and $\hat{y}_t=0.25(2)$, in excellent agreement with the
field theoretical prediction $\hat{y}_h=\hat{y}_t=1/4$. Our results provide a
strong support for the recently conjectured finite-size scaling form for the
O$(n)$ universality classes at 4D.
