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
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
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
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'%(
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
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