python - How close and remove logfile in module logging? -
import logging, os apppath = os.path.dirname(os.path.abspath(__file__)) def main(): pass errorlogpath = apppath + '//myapperrorlog.log' logging.basicconfig( level=logging.debug, filename = errorlogpath, filemode='w+', format= '%(asctime)s - %(levelname)s - %(message)s' ) try: main() os.remove(errorlogpath) #error except: logging.exception("myapp:")
file not removed on windows platform (unix normal), error - windowserror: [error 32] process can not access file.
how right close , remove file using module logging?
Comments
Post a Comment