Hello Raza,
There are only 2 things that could be happening here:
1) The exception being thrown from the try catch block is not EntityExistsException, but one of the others
IllegalStateException or IllegalArgumentException or TransactionRequiredException. Try using
and see if you are able to generate the log .
2) Make sure the logger is initialised properly and
test writing successfully to the log file first, even before you try generating the log from this piece of code.
I'll be happy to know how it went.
Regards,
Minakshi