Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-18 Thread Jeffrey Britton
I was sent via email an alternative solution which is working even better for me. In Python code use: class AppFileHandler(logging.FileHandler): def __init__(self, *args): filename, mode = args if not os.path.isabs(filename): filename = os.path.join(os.environ['APPD

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-18 Thread Jean-Michel Pichavant
Jeffrey Britton wrote: Hi, An alternative is to subclass FileHandler with a handler customized for your app. class AppFileHandler(FileHandler): def __init__(filename): if not os.path.isabs(filename): filename = os.path.join(os.environ['APPDATA'], 'whateverdir', filename) Fil

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-17 Thread Jean-Michel Pichavant
Jeffrey Britton wrote: I figured out what I was after. logfn = os.path.join(os.environ['APPDATA'], directory, filename) ensure_path(logfn) logging.config.fileConfig("logging.conf", defaults={'logfn': logfn}) In the config file use: [handler_fileHandler] class=FileHandler level=DEBUG formatter=s

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I figured out what I was after. logfn = os.path.join(os.environ['APPDATA'], directory, filename) ensure_path(logfn) logging.config.fileConfig("logging.conf", defaults={'logfn': logfn}) In the config file use: [handler_fileHandler] class=FileHandler level=DEBUG formatter=simpleFormatter args=(r'%(

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I figured out a method to enumerate all loggers. root = logging.getLogger() for key in root.manager.loggerDict.keys(): logger = logging.getLogger(key) -- http://mail.python.org/mailman/listinfo/python-list

logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I have a logging configuration file that I load via logging.config.fileConfig. The configuration file, configures a FileHandler to log to file. I wish to initialize the FileHandler to the path os.environ['APP_DATA']. However, I don't know how to configure anything other than a static path. I also