Skip to content
Snippets Groups Projects
Commit 4a124b8b authored by Glenn Glazer's avatar Glenn Glazer
Browse files

SL-323: logging improvements

parent 5811b472
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,8 @@ def silent_write(log_file_handle, text): ...@@ -48,7 +48,8 @@ def silent_write(log_file_handle, text):
#oh and because it is best effort, it is also a holey_write ;) #oh and because it is best effort, it is also a holey_write ;)
if (log_file_handle): if (log_file_handle):
#prepend text for easy grepping #prepend text for easy grepping
log_file_handle.write("SL LAUNCHER: " + text + "\n") timestamp = datetime.utcnow().strftime("%Y-%m-%D %H:%M:%S")
log_file_handle.write(timestamp + " LAUNCHER: " + text + "\n")
def get_cmd_line(): def get_cmd_line():
platform_name = platform.system() platform_name = platform.system()
...@@ -136,7 +137,7 @@ def capture_vmp_args(arg_list = None, cmd_line = None): ...@@ -136,7 +137,7 @@ def capture_vmp_args(arg_list = None, cmd_line = None):
#main entry point #main entry point
#this and a few other update manager methods really should be refactored into a util lib #this and a few other update manager methods really should be refactored into a util lib
parent_dir = update_manager.get_parent_path(update_manager.get_platform_key()) parent_dir = update_manager.get_parent_path(update_manager.get_platform_key())
log_file_handle = update_manager.get_log_file_handle(parent_dir) log_file_handle = update_manager.get_log_file_handle(parent_dir, 'launcher.log')
executable_name = "" executable_name = ""
if sys.platform.startswith('darwin'): if sys.platform.startswith('darwin'):
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
pass pass
from copy import deepcopy from copy import deepcopy
from datetime import datetime
from urlparse import urljoin from urlparse import urljoin
import apply_update import apply_update
...@@ -67,7 +68,8 @@ def silent_write(log_file_handle, text): ...@@ -67,7 +68,8 @@ def silent_write(log_file_handle, text):
#oh and because it is best effort, it is also a holey_write ;) #oh and because it is best effort, it is also a holey_write ;)
if (log_file_handle): if (log_file_handle):
#prepend text for easy grepping #prepend text for easy grepping
log_file_handle.write("UPDATE MANAGER: " + text + "\n") timestamp = datetime.utcnow().strftime("%Y-%m-%D %H:%M:%S")
log_file_handle.write(timestamp + " UPDATE MANAGER: " + text + "\n")
def after_frame(message, timeout = 10000): def after_frame(message, timeout = 10000):
#pop up a InstallerUserMessage.basic_message that kills itself after timeout milliseconds #pop up a InstallerUserMessage.basic_message that kills itself after timeout milliseconds
...@@ -176,10 +178,12 @@ def get_settings(log_file_handle, parent_dir): ...@@ -176,10 +178,12 @@ def get_settings(log_file_handle, parent_dir):
return None return None
return settings return settings
def get_log_file_handle(parent_dir): def get_log_file_handle(parent_dir, filename = None):
#return a write handle on the log file #return a write handle on the log file
#plus log rotation and not dying on failure #plus log rotation and not dying on failure
log_file = os.path.join(parent_dir, 'update_manager.log') if not filename:
return None
log_file = os.path.join(parent_dir, filename)
old_file = log_file + '.old' old_file = log_file + '.old'
#if someone's log files are present but not writable, they've screwed up their install. #if someone's log files are present but not writable, they've screwed up their install.
if os.access(log_file, os.W_OK): if os.access(log_file, os.W_OK):
...@@ -234,6 +238,7 @@ def query_vvm(log_file_handle = None, platform_key = None, settings = None, summ ...@@ -234,6 +238,7 @@ def query_vvm(log_file_handle = None, platform_key = None, settings = None, summ
#note that the only two valid options are: #note that the only two valid options are:
# # version-phx0.damballah.lindenlab.com # # version-phx0.damballah.lindenlab.com
# # version-qa.secondlife-staging.com # # version-qa.secondlife-staging.com
print "updater service host: " + repr(UpdaterServiceURL)
if UpdaterServiceURL: if UpdaterServiceURL:
#we can't really expect the users to put the protocol or base dir on, they will give us a host #we can't really expect the users to put the protocol or base dir on, they will give us a host
base_URI = urljoin('https://' + UpdaterServiceURL[0], '/update/') base_URI = urljoin('https://' + UpdaterServiceURL[0], '/update/')
...@@ -379,7 +384,7 @@ def update_manager(cli_overrides = None): ...@@ -379,7 +384,7 @@ def update_manager(cli_overrides = None):
#setup and getting initial parameters #setup and getting initial parameters
platform_key = get_platform_key() platform_key = get_platform_key()
parent_dir = get_parent_path(platform_key) parent_dir = get_parent_path(platform_key)
log_file_handle = get_log_file_handle(parent_dir) log_file_handle = get_log_file_handle(parent_dir, 'update_manager.log')
settings = None settings = None
#check to see if user has install rights #check to see if user has install rights
...@@ -466,10 +471,12 @@ def update_manager(cli_overrides = None): ...@@ -466,10 +471,12 @@ def update_manager(cli_overrides = None):
#323: On launch, the Viewer Manager should query the Viewer Version Manager update api. #323: On launch, the Viewer Manager should query the Viewer Version Manager update api.
if cli_overrides is not None: if cli_overrides is not None:
if '--update-service' in cli_overrides.keys(): if 'update-service' in cli_overrides.keys():
UpdaterServiceURL = cli_overrides['update-service'] UpdaterServiceURL = cli_overrides['update-service']
else:
#tells query_vvm to use the default
UpdaterServiceURL = None
else: else:
#tells query_vvm to use the default
UpdaterServiceURL = None UpdaterServiceURL = None
result_data = query_vvm(log_file_handle, platform_key, settings, channel_override_summary, UpdaterServiceURL) result_data = query_vvm(log_file_handle, platform_key, settings, channel_override_summary, UpdaterServiceURL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment