Check that you haven't defined any modules whose names clash with standard ones. The slightly modified script below runs on my system without error. Try it on yours and if it works, double check that you are not redefining any classes with the same names import logging import os import time class SomeClass: def __init__(self): self.
Log_dir = os.getcwd() formatter = logging. Formatter('%(asctime)s %(message)s') self. My_logger = logging.
GetLogger('my_logger') self. My_logger. SetLevel(logging.INFO) if self.
Log_dir! = None: self. Log_filename = os.path.
Join(self. Log_dir, 'run. Log') ch_file = logging.
FileHandler(self. Log_filename, 'w') ch_file. SetLevel(logging.
ERROR) ch_file. SetFormatter(formatter) self. My_logger.
AddHandler(ch_file) ch_stream = logging.StreamHandler() ch_stream. SetLevel(logging.INFO) # add formatter to ch ch_stream. SetFormatter(formatter) # add ch to logger self.
My_logger. AddHandler(ch_stream) self. My_logger.
Info("Ready.") self. My_logger. Error("My error") def main(): SomeClass() if __name__ == '__main__': main() By the way - I know you didn't ask about this, but it's not recommended practice to store loggers as instance variables - there's no point, as they're singletons anyway.
The normal approach for most users is to have a single logger = logging. GetLogger(__name__) at module level, and use that throughout the module. If you need more granularity, create a child logger of the logger using name as a prefix (e.
G %s. Detail' % __name ).
Check that you haven't defined any modules whose names clash with standard ones. The slightly modified script below runs on my system without error. Try it on yours and if it works, double check that you are not redefining any classes with the same names.
Import logging import os import time class SomeClass: def __init__(self): self. Log_dir = os.getcwd() formatter = logging. Formatter('%(asctime)s %(message)s') self.
My_logger = logging. GetLogger('my_logger') self. My_logger.
SetLevel(logging. INFO) if self. Log_dir!
= None: self. Log_filename = os.path. Join(self.
Log_dir, 'run. Log') ch_file = logging. FileHandler(self.
Log_filename, 'w') ch_file. SetLevel(logging. ERROR) ch_file.
SetFormatter(formatter) self. My_logger. AddHandler(ch_file) ch_stream = logging.StreamHandler() ch_stream.
SetLevel(logging. INFO) # add formatter to ch ch_stream. SetFormatter(formatter) # add ch to logger self.
My_logger. AddHandler(ch_stream) self. My_logger.
Info("Ready. ") self. My_logger.
Error("My error") def main(): SomeClass() if __name__ == '__main__': main() By the way - I know you didn't ask about this, but it's not recommended practice to store loggers as instance variables - there's no point, as they're singletons anyway. The normal approach for most users is to have a single logger = logging. GetLogger(__name__) at module level, and use that throughout the module.
If you need more granularity, create a child logger of the logger using __name__ as a prefix (e.g. '%s. Detail' % __name__).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.