Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
logger
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  logger behaviour setdetnet 1 884 Apr-15-2023, 05:20 AM
Last Post: Gribouillis
  how to write exception error into logger mg24 3 979 Nov-15-2022, 04:20 PM
Last Post: insharazzak
  python insert blank line in logger mg24 1 2,828 Nov-02-2022, 08:36 AM
Last Post: snippsat
  python logger help ... save logger into different folder mg24 1 1,443 Oct-25-2022, 03:04 PM
Last Post: snippsat
  Closing logger from other function problem Paqqno 1 1,108 Apr-25-2022, 11:49 AM
Last Post: Gribouillis
  Closing logger to rename directory malcoverc 1 1,199 Apr-19-2022, 07:06 AM
Last Post: Gribouillis
  logger option , where is the file? korenron 1 1,783 Apr-25-2021, 01:28 PM
Last Post: snippsat
  How to assign input file name as logger name Mekala 5 2,843 Aug-05-2020, 12:54 AM
Last Post: Larz60+
  Logger file rotation not working when python code started from windows service as exe nirvantosh 1 6,641 Jun-14-2019, 03:58 PM
Last Post: nirvantosh
  Coding a logger for firefox history kpiatrou 2 2,870 Dec-25-2018, 06:42 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020