When do we need to prove the measurabiliy of a function to write its integral? Let $f : [1,2] \rightarrow \mathbb{R}$ be a function such that $f(x) \leq 5 \ \forall x \in [1,2]$. Then can we write $\int _{1} ^{2} f(x) \,dx \leq 5$. Or do we need to first prove the measurability of $f$ to write that last inequality? Of course, I am talking about Legesge integration and I am asking this because I see people usually does not prove the measurabilty and directly  write that last inequality. 

Does one assume the measurability of $f$ before writing down that last integral inequality? If yes, then why it is ok to do so?
You don't need to "prove" that $f$ is measurable before you "write" the integral.  But if you write it, and try to integrate a function that isn't measurable, the relevant limits won't exist or converge.  The integral you wrote down is undefined, somewhat like $0/0$.
You don't need to "prove" that $f$ is measurable before you "write" the integral.  But if you write it, and try to integrate a function that isn't measurable, the relevant limits won't exist or converge.  The integral you wrote down is undefined, somewhat like $0/0$.