By definition, the payoff of a log-contract of maturity $T$ writes
$$ \phi(S_T) = \ln\left(\frac{S_T}{S_0}\right) $$
Let $\Pi_t$ denote the $t$-value of such a contingent claim. We are interested in the price at $t=0$, best known as the option premium. Theory tells us that the latter premium can be computed as
$$ \Pi_0 = e^{-rT} E^{\mathbb{Q}} \left[ \phi(S_T) \right] $$
that is, a (discounted and risk-neutral) expectation of the future payout, the payout here being a simple function of the random variable $S_T$.
Assuming we managed to draw $M$ i.i.d.(independent and identically distributed) samples of the random variable $S_T$ - which we shall denote by$(S_T^{(m)})_{m=1,...,M}$ in what follows -, we could easily infer $M$ i.i.d. samples of the random payout $\phi(S_T)=\ln(S_T/S_0)$, then take their average and multiply by the discount factor to get the option price. This is precisely the idea behind Monte Carlo. Now how to simulate i.i.d. samples of $S_T$?
From the Black-Scholes SDE expressed under the risk-neutral measure $\mathbb{Q}$, applying Itô's lemma gets you:
$$ S_T = S_0 \exp\left( (r-\frac{1}{2}\sigma^2)T + \sigma \sqrt{T} Z \right)$$
with $Z \sim \mathcal{N}(0,1)$ and hence $S_T$ is lognormally distributed.
This shows that, in order to obtain i.i.d. samples $S_T^{(m)}$, one just needs i.i.d. samples $Z^{(m)}$ out of a standard normal distribution (there should exist libraries to do that in any decent programming language)
$$ S_T^{(m)} = S_0 \exp\left( (r-\frac{1}{2}\sigma^2)T + \sigma \sqrt{T} Z^{(m)} \right),\ \ \forall m=1,...,M $$
The i.i.d. sample option payouts are then
$$ \phi\left(S_T^{(m)}\right) =\ln\left(\frac{S_T^{(m)}}{S_0} \right),\ \ \forall m=1,...,M $$
The Monte Carlo estimator of the option price is then given by
$$ S_T^{(m)} = S_0 \exp\left( (r-\frac{1}{2}\sigma^2)T + \sigma \sqrt{T} Z^{(m)} \right),\ \ \forall m=1,...,M $$
$$ \hat{\Pi}_0 = e^{-rT} \left( \frac{1}{M} \sum_{m=1}^M \phi\left(S_T^{(m)}\right) \right) $$
with $(Z^{(m)})_{m=1,...,M}$ representing $M$ i.i.d. samples out of a standard normal distribution.
$\hat{\Pi}_0$ is an unbiased estimator of the true premium $\Pi_0$ whose variance decreases proportionally to $M^{-1/2}$ (which is a direct consequence of the CLT).
[Remark 1] This result holds for any instrument whose payoff is a function of the terminal value of the asset only, i.e. $\phi(.)$ of the form $\phi(S_T)$. This is known as a European option. The situation of a log-contract with $\phi(S_T)=\ln(S_T/S_0)$ is just a particular case.
[Remark 2] A log-contract can be priced in semi-closed form (see work of Carr-Madan in that area)
$$ \Pi_0 = e^{-rT}\left( rT - \int_0^{F(0,T)} \frac{\tilde{P}(K,T)}{K^2} dK + \int_{F(0,T)}^{\infty} \frac{\tilde{C}(K,T)}{K^2} dK \right) $$
where $\tilde{P}(K,T)$ and $\tilde{C}(K,T)$ figure undiscounted European put/call option prices. This gives you a good reference to compare your MC simulations to (or assess its convergence).