When i run below code in terminal its create a log file
import logging
logging.basicConfig(filename=\'ramexample.log\',level=logging.DEBUG)
logging.debug(\

This does create a log within the pycharm terminal using the Py terminal within it. You need to check the location of where the terminal is (try dir on Windows or pwd on linux/mac). Instead of just putting in ram.log, use the full file path of where you would like the file to appear. E.G.
logging.basicConfig(filename='/Users/Donkey/Test/ram.log', level=logging.DEBUG)