Handled several exception that are
permission denied
missing entry from database
Added option to log to different file
Fix check key exist in case of % character