每次我使用Xvfb在无头firefox中执行我的测试时,我会获得大量的日志。这些日志显示不同的参数及其值。
我想知道我是否可以某种方式禁用这些日志,我搜索了一下但找不到任何有用的东西
显示以下日志,我想禁用它们。
`5 XSELINUXs still allocated at reset
SCREEN: 0 objects of 168 bytes = 0 total bytes 0 private allocs
DEVICE: 4 objects of 96 bytes = 384 total bytes 0 private allocs
CLIENT: 0 objects of 152 bytes = 0 total bytes 0 private allocs
WINDOW: 0 objects of 32 bytes = 0 total bytes 0 private allocs
PIXMAP: 1 objects of 16 bytes = 16 total bytes 0 private allocs
GC: 0 objects of 56 bytes = 0 total bytes 0 private allocs
CURSOR: 0 objects of 8 bytes = 0 total bytes 0 private allocs
CURSOR_BITS: 0 objects of 8 bytes = 0 total bytes 0 private allocs
DBE_WINDOW: 0 objects of 24 bytes = 0 total bytes 0 private allocs
TOTAL: 5 objects, 400 bytes, 0 allocs
4 DEVICEs still allocated at reset
DEVICE: 4 objects of 96 bytes = 384 total bytes 0 private allocs
CLIENT: 0 objects of 152 bytes = 0 total bytes 0 private allocs
WINDOW: 0 objects of 32 bytes = 0 total bytes 0 private allocs
PIXMAP: 1 objects of 16 bytes = 16 total bytes 0 private allocs
GC: 0 objects of 56 bytes = 0 total bytes 0 private allocs
CURSOR: 0 objects of 8 bytes = 0 total bytes 0 private allocs
CURSOR_BITS: 0 objects of 8 bytes = 0 total bytes 0 private allocs
DBE_WINDOW: 0 objects of 24 bytes = 0 total bytes 0 private allocs
TOTAL: 5 objects, 400 bytes, 0 allocs
1 PIXMAPs still allocated at reset
PIXMAP: 1 objects of 16 bytes = 16 total bytes 0 private allocs
GC: 0 objects of 56 bytes = 0 total bytes 0 private allocs
CURSOR: 0 objects of 8 bytes = 0 total bytes 0 private allocs
CURSOR_BITS: 0 objects of 8 bytes = 0 total bytes 0 private allocs
DBE_WINDOW: 0 objects of 24 bytes = 0 total bytes 0 private allocs
TOTAL: 1 objects, 16 bytes, 0 allocs
`
答案 0 :(得分:0)
这里的问题相同。没有找到一个干净的解决方案来禁用它们所以我在Jenkins中包含了一个预构建任务,以便在运行自动化测试之前清理这些日志文件。由于我的自动化测试由Jenkins定期启动,因此通常会清理日志。这样我就不会冒任何磁盘问题的风险。
答案 1 :(得分:0)
有多种方法可以解决此问题。我首先建议在一个单独的终端中初始化Xvfb,以便运行代码。 Xvfb日志消息将被转储到它运行的终端中。
另一种解决方案是使用包装器。例如,如果您在python中进行编码,则可以尝试https://github.com/cgoldberg/xvfbwrapper
答案 2 :(得分:0)
如果将日志输出从Xvfb重定向到/ dev / null,则可以使这些详细消息消失。
就我而言,我在Jenkins中使用Xvfb插件,并在CentOS机器上使用Firefox运行Selenium测试。得到了相同的详细消息。
我通过UN-CHECKING解决了其中一个用于"记录Xvfb日志输出" - 或
您也可以在$或#提示符下执行此操作:
/usr/bin/Xvfb :99 -ac -screen 0 1600x1200x16 2>/dev/null 1>&2 &