Write logs in html file using log4cplus in C++ linux

南楼画角 提交于 2019-12-06 02:48:34
kebs

aha Could be a starting point to produce an html file, but to get a richer formatting you could probably write some script using awk to html-ize your output.

For example, considering the following output file:

2014-07-02 20:52:39 DEBUG className:200 - This is debug message
2014-07-02 20:52:39 DEBUG className:201 - This is debug message2

The following script will produce some valid html table based on the three first fields:

#!/usr/bin/awk -f

BEGIN { print "<table>"; }
      { print "<tr><td>" $1 "<td></td>" $2 "<td></td>" $3  "</td></tr>"    }
END   { print "</table>"  }

Just expand on this.

To get realtime handling, you will need to daemonize it.

log4cplus currently (2015-04-18) does not support HTML formatted file output in any specific way. You could sort of fake it using a layout. Or you could write your own Appender instance.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!