How to obtain the logarithm from this numerical integral?
You have already found the value of $\log(2)$. Congrats!
Hint:
$$\int_0^1\frac{\mathrm{d}x}{1+x}=\log(2)$$
So there you have your context and what you have found is the value of the integration i.e. $\log(2)$ by using numerical methods (Trapezoidal rule).
$$\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b=\log_e(1+b) - \log_e(1+a)=\log_e\frac{1+b}{1+a}$$
For $a=0$ and $b=1$ this goes to $\log_e2$
That's my answer.
But ... if you want to know why $\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b$ then here is the answer to that question.
We kind of have to work backwards, so let's start with: $$y=\log_e(1+x)$$ Using laws of indices:
$$1+x=e^y$$ Differentiate both sides with repect to $x$: $$1=e^y \frac{dy}{dx}$$ Divide both sides by $e^y$: $$\frac{1}{e^y}=\frac{dy}{dx}$$ We know that $e^y =1+x$ so let's sub that in: $$\frac{1}{1+x}=\frac{dy}{dx}$$ Multiply both sides by $dx$: $$\frac{1}{1+x}dx=dy$$ Integrate both sides from $x=a$ to $x=b$: $$\int_a^b \frac{1}{1+x}dx=\int_{y(a)}^{y(b)} dy$$ Left hand side is what we want, just integrate the right hand side: $$\int_a^b \frac{1}{1+x}dx=y|_{y(a)}^{y(b)}$$ We already have an expression for $y$ which we defined at the beginning, so let's sub that in: $$\int_a^b \frac{1}{1+x}dx=\log_e (1+x) |_a^b$$ This is the required relation.
You could simply translate horizontally by $1$ to the right:
$\frac{1}{1+x}$ looks the same between $0$ and $1$ than $\frac{1}{x}$ between $1$ and $2$.
So:
$$\int_0^1\frac{\mathrm{d}x}{1+x}=\int_1^2\frac{\mathrm{d}x}{x}$$
Which is $\log(2)$ by definition.