本文整理汇总了Python中workbench.log.log_error函数的典型用法代码示例。如果您正苦于以下问题:Python log_error函数的具体用法?Python log_error怎么用?Python log_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: show_schema_manager
def show_schema_manager(editor, selection, table_maintenance=False):
try:
editor.executeManagementQuery("select 1", 0)
except grt.DBError, e:
mforms.Utilities.show_error("Schema Inspector", "Can not launch the Schema Inspector because the server is unreacheble.", "OK", "", "")
log_error("Can not launch the Schema Inspector because the server is unreacheble.\n")
return False
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:7,代码来源:sqlide_catalogman_ext.py
示例2: get_table_columns
def get_table_columns(self, table):
cols = []
try:
rset = self.main.editor.executeManagementQuery("SHOW COLUMNS FROM `%s`.`%s`" % (table['schema'], table['table']), 1)
except grt.DBError, e:
log_error("SHOW COLUMNS FROM `%s`.`%s` : %s" % (table['schema'], table['table'], e))
rset = None
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:7,代码来源:sqlide_power_export_wizard.py
示例3: __init__
def __init__(self, editor, schema_name):
mforms.AppView.__init__(self, False, "schema_inspector", False)
self.editor = editor
self.tabview = mforms.newTabView()
self.add(self.tabview, True, True)
self.pages = []
tabs = [SchemaInfoPanel, TableManagerParent, ColumnManager, IndexManager, TriggerManager, ViewManager, ProcedureManager, FunctionManager, GrantsManager]
if self.editor.serverVersion.majorNumber > 5 or (self.editor.serverVersion.majorNumber == 5 and self.editor.serverVersion.minorNumber >= 1):
tabs.append(EventManager)
# tabs.append(AccessManager)
for Tab in tabs:
try:
if Tab is IndexManager:
tab = Tab(editor, schema_name, self)
else:
tab = Tab(editor, schema_name)
setattr(self, "tab_"+tab.node_name, tab)
self.pages.append(tab)
self.tabview.add_page(tab, tab.caption)
except Exception:
import traceback
log_error("Error initializing tab %s: %s\n" % (tab.node_name, traceback.format_exc()))
self.refresh()
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:27,代码来源:sqlide_catalogman_ext.py
示例4: get_info
def get_info(self):
cmd = "%s -al -so %s" % (get_exe_path("ogrinfo"), self.get_path())
p1 = cmd_executor(cmd)
sout, serr = p1.communicate(input)
if serr:
log_error("There was an error getting file information: %s" % serr)
import re
p = re.compile("^(\w+):\s(\w+)\s\(([0-9\.]+)\)", re.IGNORECASE)
for line in sout.splitlines():
if line.startswith("Layer name: "):
self.layer_name_lbl.set_text(line.split(':')[1].strip())
self.layer_name = line.split(':')[1].strip()
self.table_name.set_value(line.split(':')[1].strip())
else:
m = p.match(line)
if m is not None:
row = self.column_list.add_node()
row.set_bool(0, True)
row.set_string(1, m.group(1))
from grt.modules import Utilities
res = Utilities.fetchAuthorityCodeFromFile("%s.prj" % os.path.splitext(self.get_path())[0])
if res:
self.epsg_lbl.set_text(res)
else:
self.epsg_lbl.set_text(0)
log_info("Can't find EPSG fallback to 0")
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:27,代码来源:sqlide_import_spatial.py
示例5: prepare_import
def prepare_import(self):
if self.importer and self.importer.is_running:
mforms.Utilities.show_message("Importing...", "Import thread is already running.", "Ok", "", "")
raise RuntimeError("Import is already running")
self.importer = SpatialImporter()
self.importer.filepath = self.get_path()
if self.importer.filepath == None or not os.path.isfile(self.importer.filepath):
raise RuntimeError("Unable to open specified file: %s" % self.importer.filepath)
self.importer.my_pwd = self.get_mysql_password(self.main.editor.connection)
if self.importer.my_pwd == None:
log_error("Cancelled MySQL password input\n")
raise RuntimeError("Cancelled MySQL password input")
self.importer.my_host = self.main.editor.connection.parameterValues.hostName
self.importer.my_port = self.main.editor.connection.parameterValues.port
self.importer.my_user = self.main.editor.connection.parameterValues.userName
self.importer.my_schema = self.main.selected_schema
self.importer.skipfailures = self.main.content_preview_page.skipfailures_chb.get_active()
self.importer.import_overwrite = self.main.content_preview_page.skipfailures_chb.get_active()
self.importer.import_append = self.main.content_preview_page.append_chb.get_active()
if self.main.content_preview_page.table_name.get_string_value() != "":
self.importer.import_table = self.main.content_preview_page.table_name.get_string_value()
self.importer.selected_fields = ",".join(self.main.content_preview_page.get_fields())
return True
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:30,代码来源:sqlide_import_spatial.py
示例6: enable_mdl_instrumentation
def enable_mdl_instrumentation(self):
try:
self.ctrl_be.exec_sql("UPDATE performance_schema.setup_instruments SET enabled='YES' WHERE name = 'wait/lock/metadata/sql/mdl'")
except Exception, e:
log_error("Error enabling MDL instrumentation: %s\n" % e)
mforms.Utilities.show_error("Enable MDL Instrumentation", "Error enabling performance_schema MDL instrumentation.\n%s" % e, "OK", "", "")
return
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:7,代码来源:wb_admin_connections.py
示例7: shutdown
def shutdown(self):
log_error("shutting down admn\n")
dprint_ex(2, " closing")
self.closing = True
for tab in self.tabs:
if hasattr(tab, "shutdown"):
res = tab.shutdown()
if res is False: # It has to explicitely return False to cancel shutdown
self.closing = False
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:9,代码来源:wb_admin_main.py
示例8: cmd_executor
def cmd_executor(cmd):
p1 = None
if platform.system() != "Windows":
try:
p1 = subprocess.Popen("exec " + cmd, stdout = subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
except OSError, exc:
log_error("Error executing command %s\n%s\n" % (cmd, exc));
import traceback
traceback.print_ext()
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:9,代码来源:sqlide_import_spatial.py
示例9: generateCertificates
def generateCertificates(parent, conn, conn_id):
try:
log_info("Running SSL Wizard\nParent: %s\nUser Folder: %s\nConn Parameters: %s\nConn ID: %s\n" % (str(parent), mforms.App.get().get_user_data_folder(), str(conn.parameterValues), conn_id))
p = mforms.fromgrt(parent)
log_info("Running SSL Wizard\n%s\n" % str(p))
r = SSLWizard(p, conn, conn_id)
r.run(True)
except Exception, e:
log_error("There was an exception running SSL Wizard.\n%s\n\n%s" % (str(e), traceback.format_exc()))
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:9,代码来源:wb_utils_grt.py
示例10: clear_button_clicked
def clear_button_clicked(self):
for filename in os.listdir(self.main.results_path):
filepath = os.path.join(self.main.results_path, filename)
try:
if os.path.isfile(filepath):
os.unlink(filepath)
except Exception, e:
log_error("SSL Wizard: Unable to remove file %s\n%s" % (filepath, str(e)))
return
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:9,代码来源:wb_utils_grt.py
示例11: get_message
def get_message(self, port):
if port not in self.tunnel_by_port:
log_error("Looking up invalid port %s\n" % port)
return None
tunnel = self.tunnel_by_port[port]
try:
return tunnel.q.get_nowait()
except Queue.Empty:
return None
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:9,代码来源:sshtunnel.py
示例12: repaint
def repaint(self, cr, x, y, w, h):
xoffs, yoffs = self.parent.relayout()
self.offset = xoffs, yoffs
c = Context(cr)
try:
self.canvas.repaint(c, xoffs, yoffs, w, h)
except Exception:
import traceback
log_error("Exception rendering dashboard: %s\n" % traceback.format_exc())
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:10,代码来源:wb_admin_performance_dashboard.py
示例13: do_delete_account
def do_delete_account(self, username, host):
query = REMOVE_USER % {"user":escape_sql_string(username), "host":escape_sql_string(host)}
try:
self.ctrl_be.exec_sql("use mysql")
self.ctrl_be.exec_sql(query)
except QueryError, e:
log_error('Error removing account %[email protected]%s:\n%s' % (username, host, str(e)))
if e.error == 1227: # MySQL error code 1227 (ER_SPECIFIC_ACCESS_DENIED_ERROR)
raise Exception('Error removing the account %[email protected]%s:' % (username, host),
'You must have the global CREATE USER privilege or the DELETE privilege for the mysql '
'database')
raise e
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:12,代码来源:wb_admin_security_be.py
示例14: tab_changed
def tab_changed(self):
if self.old_active_tab and hasattr(self.old_active_tab, "page_deactivated"):
self.old_active_tab.page_deactivated()
i = self.tabview.get_active_tab()
panel = self.tabs[i]
if panel is not None and hasattr(panel, "page_activated"):
try:
panel.page_activated()
except Exception, e:
import traceback
log_error("Unhandled exception in Admin for %s: %s\n" % (panel, traceback.format_exc()))
mforms.Utilities.show_error("Error", "An unhandled exception occurred (%s). Please refer to the log files for details." % e, "OK", "", "")
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:13,代码来源:wb_admin_main.py
示例15: set_keepalive
def set_keepalive(self, port, keepalive):
if keepalive == 0:
log_info("SSH KeepAlive setting skipped.\n")
return
tunnel = self.tunnel_by_port.get(port)
if not tunnel:
log_error("Looking up invalid port %s\n" % port)
return
transport = tunnel._client.get_transport()
if transport is None:
log_error("SSHTransport not ready yet %d\n" % port)
return
transport.set_keepalive(keepalive)
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:14,代码来源:sshtunnel.py
示例16: kill
def kill(self):
self.abort_requested = True
if self.process_handle:
if platform.system() == 'Windows':
cmd = "taskkill /F /T /PID %i" % self.process_handle.pid
log_debug("Killing task: %s\n" % cmd)
subprocess.Popen(cmd , shell=True)
else:
import signal
try:
log_debug("Sending SIGTERM to task %s\n" % self.process_handle.pid)
os.kill(self.process_handle.pid, signal.SIGTERM)
except OSError, exc:
log_error("Exception sending SIGTERM to task: %s\n" % exc)
self.print_log_message("kill task: %s" % str(exc))
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:15,代码来源:sqlide_import_spatial.py
示例17: run_command
def run_command(self, command, output_to = subprocess.PIPE):
try:
set_shell = True if sys.platform == "win32" else False
p = subprocess.Popen(command, stdout=output_to, stderr=subprocess.PIPE, shell=set_shell)
out = p.communicate()
if p.returncode != 0:
log_error("Running command: %s\nOutput(retcode: %d):\n%s\n" % (str(command), p.returncode, str(out)))
return False
return True
except ValueError, e:
log_error("Running command: %s\nValueError exception\n" % (str(e.cmd)))
return False
开发者ID:alMysql,项目名称:mysql-workbench,代码行数:15,代码来源:wb_utils_grt.py
示例18: load_data
def load_data(self):
data = None
try:
result = self.ctrl_be.exec_query("SELECT sys.ps_thread_stack(%d, %s)" % (self.thread_id, "TRUE" if self.enable_debug_info else "FALSE"))
if result is not None:
if result.nextRow():
data = result.stringByIndex(1)
if data:
data = data.replace("\0", "") # workaround for server bug
return self.parse_data(json.loads(data))
except Exception, e:
import traceback
#open("/tmp/data.js", "w+").write(data)
log_error("Exception during sys.ps_thread_stack(%d, %s):\n%s\n" % (self.thread_id, "TRUE" if self.enable_debug_info else "FALSE", traceback.format_exc()))
mforms.Utilities.show_error("Error Getting Thread Stack", "The thread stack for thread %d can't be loaded, please check if your sys schema is properly installed and available.\n%s" % (self.thread_id, e), "OK", "", "")
return None
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:16,代码来源:wb_admin_connections.py
示例19: enable_disable_instrumentation
def enable_disable_instrumentation(self):
selected_conn = self.connection_list.get_selection()
if not selected_conn:
return
instr_state = 'YES'
if selected_conn[0].get_string(11).startswith('YES'):
instr_state = 'No'
for sel in selected_conn:
connid = sel.get_long(7)
try:
self.ctrl_be.exec_sql("UPDATE performance_schema.threads SET instrumented = '%s' WHERE thread_id = %d LIMIT 1" % (instr_state, connid))
except Exception, e:
log_error("Error enabling thread instrumentation: %s\n" % e)
mforms.Utilities.show_error("Toggle Thread Instrumentation", "Error setting instrumentation for thread %d: %s" % (connid, e), "OK", "", "")
break
开发者ID:Roguelazer,项目名称:mysql-workbench,代码行数:16,代码来源:wb_admin_connections.py
示例20: load_privileges
def load_privileges(self, host):
# Clears any previously loaded privileges
self._granted_privileges = {}
if host in self.applicant_hosts:
# If there are hosts it means there are privileges applicable for the user
# On the indicated host
result = self.context.ctrl_be.exec_query("SHOW GRANTS FOR `%s`@`%s`" % (self.user, host))
context = grt.modules.MySQLParserServices.createParserContext(self._character_sets, self._target_version, 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION', 1)
if result:
while result.nextRow():
statement = result.stringByIndex(1)
grant_data = None
try:
grant_data = grt.modules.MySQLParserServices.parseStatementDetails(context, statement)
if not grant_data['error']:
# Gets the target scope for the privileges
target_string = grant_data['target']
target = None
# Search for an already existing target
for tgt in self._granted_privileges.keys():
if tgt.identical(target_string):
target = tgt
# If not found, creates one
if not target:
target = PrivilegeTarget()
target.set_from_string(target_string)
# Gets the privilege list
priv_list = grant_data['privileges']
# Adds the privileges to the granted list
self.add_privileges(target, priv_list)
else:
log_error('An error occurred parsing GRANT statement: %s\n -> %s\n' % (statement, grant_data['error']))
except Exception, exc:
log_error('An error occurred parsing GRANT statement: %s\n -> %s\n' % (statement, exc))
else:
log_warning('There are no grants defined for %[email protected]%s\n' % (self.user, self.host))
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:47,代码来源:wb_admin_user_privileges.py
注:本文中的workbench.log.log_error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论