Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python logging how to create logfile as html

I read in wikipedia that python logging module was inspired by log4j .In log4j ,there is an HTMLLayout with which one can create the log file as html.Is there any such facility in python logging? Or do anyone know how I can format the log output into an html file ?

like image 539
jimgardener Avatar asked Aug 12 '11 11:08

jimgardener


People also ask

How do you capture a log in Python?

Configuring Logging Creating loggers, handlers, and formatters explicitly using Python code that calls the configuration methods listed above. Creating a logging config file and reading it using the fileConfig() function. Creating a dictionary of configuration information and passing it to the dictConfig() function.


1 Answers

the python logging module uses a http://docs.python.org/library/logging.html#logging.Formatter to format the output.

You can set your own formatter to output html. (see this other question How can I color Python logging output? for details on how to define a formatter)

like image 109
njzk2 Avatar answered Oct 13 '22 11:10

njzk2