Skip to content

Commit

Permalink
fix: disable log profiling by default
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Apr 26, 2020
1 parent a3ad2e5 commit 39bad3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/chapters/envs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Here is the list of environment variables that ``jina`` respects during runtime.
.. highlight:: python
.. code-block:: python
os.environ['JINA_LOG_NO_PROFILING'] = 'true'
os.environ['JINA_LOG_PROFILING'] = 'true'
from jina.flow import Flow
Expand Down Expand Up @@ -104,9 +104,9 @@ Here is the list of environment variables that ``jina`` respects during runtime.

:default: unset

.. confval:: JINA_LOG_NO_PROFILING
.. confval:: JINA_LOG_PROFILING

Turn off the server side event logging for profiling, you won't able to see "task" tab in the dashboard.
Turn on the server side event logging for profiling, otherwise you won't able to see "task" tab in the dashboard.

:default: unset

Expand Down
2 changes: 1 addition & 1 deletion jina/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
'JINA_LOG_FILE',
'JINA_LOG_LONG',
'JINA_LOG_NO_COLOR',
'JINA_LOG_NO_PROFILING',
'JINA_LOG_PROFILING',
'JINA_LOG_SSE',
'JINA_LOG_VERBOSITY',
'JINA_PROFILING',
Expand Down
9 changes: 4 additions & 5 deletions jina/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

default_logger = get_logger('JINA') #: a logger at the global-level

if 'JINA_LOG_NO_PROFILING' in os.environ:
profile_logger = default_logger
else:
# change to enable by default
if 'JINA_LOG_PROFILING' in os.environ:
profile_logger = get_logger('PROFILE', log_profile=True) #: a logger for profiling
default_logger.success('profiling is enabled, to disable it please set JINA_LOG_NO_PROFILING before start')
default_logger.success('profiling is enabled')
else:
profile_logger = default_logger

0 comments on commit 39bad3f

Please sign in to comment.