TimedRotatinigFileHandler
लागू करने के लिए लॉगिंग कॉन्फ़िगरेशन फ़ाइल का उपयोग करने का प्रयास कर रहा है।पायथन 2.4.3: कॉन्फ़िगरर्स। कोई पता नहीं: कोई खंड नहीं: 'स्वरूपक'
बस किसी कारण से कॉन्फ़िगरेशन फ़ाइल नहीं लेगा।
किसी भी सुझाव की सराहना की।
x.py:
import logging
import logging.config
import logging.handlers
logging.config.fileConfig("x.ini")
MyLog = logging.getLogger('x')
MyLog.debug('Starting')
x.ini:
[loggers]
keys=root
[logger_root]
level=NOTSET
handlers=trfhand
[handlers]
keys=trfhand
[handler_trfhand]
class=handlers.TimedRotatingFileHandler
when=M
interval=1
backupCount=11
formatter=generic
level=DEBUG
args=('/var/log/x.log',)
[formatters]
keys=generic
[formatter_generic]
class=logging.Formatter
format=%(asctime)s %(levelname)s %(message)s
datefmt=
Traceback (most recent call last):
File "x.py", line 5, in ?
logging.config.fileConfig("x.ini")
File "/usr/lib/python2.4/logging/config.py", line 76, in fileConfig
flist = cp.get("formatters", "keys")
File "/usr/lib/python2.4/ConfigParser.py", line 511, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'formatters'
धन्यवाद
धन्यवाद एडम! वह यह था। – user981163
फिक्स क्या था? – ProNeticas