Added Log for server and fixed log/debug mode