\documentclass[]{standalone}
\usepackage[]{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis y line=left, axis x line=middle,
width=\textwidth,
grid=both,
%ymin = 0, ymax = 1.2,
xmin = 0,xmax=5,
xtick ={0,1,2,3,4},
ytick ={0, ln(2), ln(3), ln(4)},
yticklabels={0, $\log 2$, $\log 3$, $\log 4$},
ticklabel style={font=\footnotesize},
label style={font=\footnotesize},
xlabel={$x$},
ylabel={$\log(x)$},
]
\addplot [domain=0.5:5,samples=100,black,very thick] {ln(x)};
\draw[pattern=north west lines, pattern color=gray] (1,0) -- (1,{ln(2)})--(2,{ln(2)}) --(1,0) circle;
\draw[pattern=north west lines, pattern color=gray] (2,{ln(2)}) -- (2,{ln(3)})--(3,{ln(3)}) --(2,{ln(2)}) circle;
\draw[pattern=north west lines, pattern color=gray] (3,{ln(3)}) -- (3,{ln(4)})--(4,{ln(4)}) --(3,{ln(3)})circle;
%\addplot [domain=0:5,samples=100,black,dashed,very thick] {1/(1+x)^2)};
%\legend{$P_l$,$P_i$};
\end{axis}
\end{tikzpicture}
\end{document}