clean code

solved java concurrent exception error
added the case for handling only print on console no log file