0

I am using Python logging module and using YAML file to define the configuration, then initialize the logging as follows:

with open(config_file_path, 'r') as f:
        config = yaml.load(f.read())
        logging.config.dictConfig(config)

Is there a way to monitor for file changes so that the new configuration is automatically picked up by logging module without having to restart the application?

Charles
  • 1,153
  • 1
  • 15
  • 27
  • 2
    Seems your question is not about python logging at all but about detecting file changes, many duplicates for that. http://stackoverflow.com/questions/5738442/detect-file-change-without-polling http://stackoverflow.com/questions/182197/how-do-i-watch-a-file-for-changes-using-python etc. – Eran Dec 24 '15 at 06:18
  • Thanks @Eran for the link! – Charles Dec 24 '15 at 06:21

1 Answers1

1

You can set your logger to listen for config changes on a socket.

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203