|
8 | 8 | import json |
9 | 9 | import logging.config |
10 | 10 | import logging.handlers |
11 | | -import getpass |
12 | 11 | import threading |
13 | 12 |
|
14 | 13 |
|
|
41 | 40 | "formatter": "simple", |
42 | 41 | "stream": "ext://sys.stdout" |
43 | 42 | }, |
44 | | - |
45 | | - "graylog_gelf": { |
46 | | - "class": "pygelf.GelfUdpHandler", |
| 43 | + |
| 44 | + "local_file_handler": { |
| 45 | + "class": "logging.handlers.RotatingFileHandler", |
| 46 | + # "class": "logging.handlers.FileHandler", |
47 | 47 | "level": "DEBUG", |
48 | | - # Obviously a DLS-specific configuration: the graylog server address and port |
49 | | - # Use the input "Load Balanced GELF TCP" on graylog2. |
50 | | - "host": "graylog2",#.diamond.ac.uk",# "localhost", - use locaklhost for tests |
51 | | - "port": 12201, |
52 | | - "debug": True, |
53 | | - # The following custom fields will be disabled if setting this False |
54 | | - "include_extra_fields": True, |
55 | | - "username": getpass.getuser(), |
56 | | - "pid": os.getpid(), |
57 | | - "application": "BarcodeScanner", |
58 | | - "facility": "XChem", |
59 | | - "_version": version.VERSION |
| 48 | + "formatter": "extended", |
| 49 | + "filename": "debug.log", |
| 50 | + "maxBytes": MAXBYTES, |
| 51 | + "backupCount": BACKUPCOUNT, |
| 52 | + "encoding": ENCODING, |
| 53 | + "delay" : True |
60 | 54 | }, |
61 | 55 |
|
62 | 56 | }, |
63 | 57 | "root": { |
64 | 58 | # Set the level here to be the default minimum level of log record to be produced |
65 | 59 | # If you set a handler to level DEBUG you will need to set either this level |
66 | 60 | "level": "DEBUG", |
67 | | - "handlers": ["console", "graylog_gelf"] |
| 61 | + "handlers": ["local_file_handler"] #["console", "local_file_handler"] |
68 | 62 | } |
69 | 63 | } |
70 | | - |
71 | | - |
72 | 64 | class ThreadContextFilter(logging.Filter): |
73 | 65 | """A logging context filter to add thread name and ID.""" |
74 | 66 |
|
|
0 commit comments