Python Forum
logger - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: logger (/thread-11372.html)



logger - saisankalpj - Jul-05-2018

i have a method
def set_logger():
handler = logging.FileHandler(logpath)
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger
in the log file it is getting logged as many times i called the method . is there a way such that i can call the method once and next time just get the logger object without executing all statements