2012-11-20 57 views
1

我正在使用Ruby Selenium-webdriver编写脚本。运行该脚本后,我收到的控制台以下日志 -防止在控制台上打印日志

LOG addons.manager: Application has been upgraded 
LOG addons.xpi: startup 
LOG addons.xpi: Skipping unavailable install location app-system-local 
LOG addons.xpi: Skipping unavailable install location app-system-share 
LOG addons.xpi: checkForChanges 
LOG addons.xpi-utils: Opening database 
LOG addons.xpi-utils: Creating database schema 
LOG addons.xpi: New add-on [email protected] installed in app-profile 
LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global 
LOG addons.xpi: New add-on {BBDA0591-3099-440a-AA10-41764D9DB4DB} installed in winreg-app-global 
LOG addons.xpi: New add-on [email protected] installed in winreg-app-global 
LOG addons.xpi: Updating database with changes to installed add-ons 
LOG addons.xpi-utils: Updating add-on states 
LOG addons.xpi-utils: Writing add-ons list 
LOG addons.xpi: shutdown 
LOG addons.xpi-utils: shutdown 
LOG addons.xpi-utils: Database closed 
LOG addons.xpi: startup 
LOG addons.xpi: Skipping unavailable install location app-system-local 
LOG addons.xpi: Skipping unavailable install location app-system-share 
LOG addons.xpi: checkForChanges 
LOG addons.xpi: No changes found 

我不想被在控制台上印刷这些日志,我只希望不管我的程序返回到标准输出,将在控制台上打印。有什么办法可以阻止Ruby中的这些日志?

ActiveRecord::Base.logger = nil 

这将在控制台中工作:第一

import traceback 
Settings.ActionLogs=False 
Settings.InfoLogs=False 
Settings.DebugLogs=False 

回答

0

运行控制台命令,然后运行你的代码 - 在Python中,我们可以做到这一点使用以下。

+0

它没有工作。我也在我的代码中试过以下代码 - 需要'记录器' require'active_record' ActiveRecord :: Base.logger = nil – TDHM

相关问题