Chern class of a logarithmic connection

Let $X$ be a smooth complex projective algebraic variety and $E$ a line bundle on $X$. It is a classical result that if $E$ carries an integrable connection, then the first Chern class $c_1(E)$ vanishes. I am interesting in the following variant: let $D$ be a normal crossing divisor and $\nabla: E \to E \otimes \Omega^1_X(\log D)$ an integrable connection with logarithmic singularities along $D$. Denote $$\mathrm{Res}_{D_i} \nabla$$ the residue of $\nabla$ at an irreducible component $D_i$ of $D$. As $E$ has rank one, it can be identified with a complex number.

Proposition. One has $c_1(E)=-\sum_i \mathrm{Res}_{D_i} \nabla \cdot [D_i]$

Could anybody explain me how to prove such a result?

More generally, for a vector bundle $E$ consider a short exact sequence $$0\rightarrow End(E)\otimes\Omega^1\rightarrow End(E)\otimes \Omega^1(D)\rightarrow End(E)\otimes \mathcal{O}_D\rightarrow 0,$$ where the rightmost map is the residue. Then the residue of a connection gives a well-defined class in $H^0(X, End(E)\otimes\mathcal{O}_D)$ and its image under the connecting homomorphism $H^0(X, End(E)\otimes\mathcal{O}_D)\rightarrow H^1(X, End(E)\otimes\Omega^1)$ is minus the Atiyah class $a(E)$, i.e. the class of the Atiyah sequence $$0\rightarrow End(E)\rightarrow \mathcal{A}_E\rightarrow T_X\rightarrow 0,$$ where $\mathcal{A}_E$ is the bundle of first-order differential operators on $E$.
One can compute Chern classes by $$c_k(E) = \frac{(-1)^k}{k!} tr(a(E)^{\wedge k}).$$ For instance, you get the formula for the first Chern class of a line bundle you wrote above.