本文整理汇总了Python中script.util.GaussLog.GaussLog.closeLog方法的典型用法代码示例。如果您正苦于以下问题:Python GaussLog.closeLog方法的具体用法?Python GaussLog.closeLog怎么用?Python GaussLog.closeLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类script.util.GaussLog.GaussLog
的用法示例。
在下文中一共展示了GaussLog.closeLog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LocalBackup
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import closeLog [as 别名]
class LocalBackup():
'''
classdocs
'''
def __init__(self, user = "", backupDir = "", backupPara = False, backupBin = False, logFile = ""):
'''
Constructor
'''
self.backupDir = backupDir
self.backupPara = backupPara
self.backupBin = backupBin
self.logFile = logFile
self.installPath = ""
self.user = user
self.group = ""
self.nodeInfo = None
self.logger = None
self.__hostnameFile = None
##static parameter
self.defaultLogDir = ""
self.logName = "gs_local_backup.log"
self.envirName = "GAUSS_VERSION"
self.binTarName = "binary.tar"
self.paraTarName = "parameter.tar"
self.hostnameFileName = "HOSTNAME"
####################################################################################
# This is the main install flow.
####################################################################################
def run(self):
'''
check install
'''
self.logger = GaussLog(self.logFile, "LocalBackup")
try:
self.parseConfigFile()
self.checkBackupDir()
self.doBackup()
except Exception,e:
self.logger.closeLog()
raise Exception(str(e))
self.logger.closeLog()
示例2: elif
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import closeLog [as 别名]
elif (key == "-l"):
logFile = os.path.abspath(value)
elif(key == "-i"):
if (value.isdigit()):
instanceIds.append(int(value))
else:
GaussLog.exitWithError("Parameter invalid. -i %s is not digit." % value)
# check if user exist and is the right user
PlatformCommand.checkUser(g_clusterUser)
#check log dir
if (logFile == ""):
logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "", "")
#Init logger
global g_logger
g_logger = GaussLog(logFile, "CheckConfig")
try:
checker = CheckNodeEnv(cooParams, dataParams, instanceIds)
checker.run()
g_logger.log("Check config on node[%s] successfully!" % socket.gethostname())
g_logger.closeLog()
sys.exit(0)
except Exception, e:
g_logger.logExit(str(e))
if __name__ == '__main__':
main()
示例3: elif
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import closeLog [as 别名]
elif (key == "-p"):
installPath = value.strip()
elif (key == "-u"):
user = value.strip()
elif (key == "-c"):
localPort = value.strip()
elif (key == "-l" or key == "--logpath"):
logFile = value.strip()
elif (key == "-d" or key == "--detail"):
detail = True
else:
GaussLog.exitWithError("Unknown parameter for GaussStat: %s" % key)
if(not os.path.exists(installPath) or user == "" or localPort == ""):
usage()
GaussLog.exitWithError("indispensable paramter missed.")
if(logFile == ""):
logFile = "%s/om/gaussdb_local.log" % DefaultValue.getUserLogDirWithUser(user)
logger = GaussLog(logFile, "GaussStat")
try:
stat = GaussStat(installPath, user, localPort, logger, detail)
stat.collect()
stat.outPut()
except Exception, e:
logger.logExit("Can't get statistics, reason: %s" % str(e))
logger.closeLog()