Skip to content

Commit

Permalink
Logging improvements (#1228)
Browse files Browse the repository at this point in the history
* Logging improvements

* Update logging info to warning

---------

Co-authored-by: Gavin Aguiar <gavin@GavinPC>
  • Loading branch information
gavin-aguiar and Gavin Aguiar authored May 2, 2023
1 parent 4a9a38e commit 1eebabc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions azure_functions_worker/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ async def _handle__worker_init_request(self, request):

if DependencyManager.is_in_linux_consumption() \
and is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT):
logger.info(
"PYTHON_LOAD_FUNCTIONS_INIT enabled. Importing azure functions")
import azure.functions # NoQA

# loading bindings registry and saving results to a static
Expand Down
10 changes: 5 additions & 5 deletions azure_functions_worker/utils/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,17 @@ def reload_azure_google_namespace_from_worker_deps(cls):
"""
# Reload package namespaces for customer's libraries
packages_to_reload = ['azure', 'google']
packages_reloaded = []
for p in packages_to_reload:
try:
logger.info('Reloading %s module', p)
importlib.reload(sys.modules[p])
packages_reloaded.append(p)
except Exception as ex:
logger.info('Unable to reload %s: \n%s', p, ex)
logger.info('Reloaded %s module', p)
logger.warning('Unable to reload %s: \n%s', p, ex)

logger.info(f'Reloaded modules: {",".join(packages_reloaded)}')

# Reload azure.functions to give user package precedence
logger.info('Reloading azure.functions module at %s',
inspect.getfile(sys.modules['azure.functions']))
try:
importlib.reload(sys.modules['azure.functions'])
logger.info('Reloaded azure.functions module now at %s',
Expand Down

0 comments on commit 1eebabc

Please sign in to comment.