I want to compute $\int_0^1\ln(1-x)dx$.
Using integration by parts we have: $\int_0^1\ln(1-x)dx=\int_0^1(x)'\ln(1-x)dx=x\ln(1-x)|_0^1-\int_0^1\frac{x}{1-x}dx$ but limit at $1$ of $x\ln(1-x)$ is $-\infty$ and $\int_0^1\frac{x}{1-x}dx$ does not converge.
I know the answer is $-1$ because desired integral is equal to $\int_0^1\ln(x)dx$ or using integration by parts but with $-(1-x)$ not $x$ yields $-1$ but why first approach does not work and produce false equality?
You have to do the substitution $y=1-x$. The problem is that in your solution you will have two limits that diverge but cancel each other out. You involuntarily split the limits, which makes it a bit confusing since you get something of the form $\infty-\infty$. This doesn't mean that your integral doesn't exist (it's an indeterminate form).