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]$$c_1(E)=-\sum_i \mathrm{Res}_{D_i} \nabla \cdot [D_i]$
Could anybody explain me how to prove such a result?