Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging improvements #1228

Merged
merged 4 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
gavin-aguiar marked this conversation as resolved.
Show resolved Hide resolved
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)}')
gavin-aguiar marked this conversation as resolved.
Show resolved Hide resolved

# 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