Hi,
I just noticed that no logs are captured by panel unless they are emitted on the ‘error’ level.
Panel serve command:
nohup panel serve --port 5006 --allow-websocket-origin dev.materialindicators.com --num-procs 4 MI_App_RC1-Copy5_1D.ipynb --dev --auth-module=../auth.py --log-level debug --log-file webapp
_RC1.log --stats-log-frequency 300000 --mem-log-frequency 300000 --keep-alive 30000 &
In-app logger:
session = os.path.join(wdir,"webapp_RC1.log")
log_settings = logging.basicConfig(handlers=[logging.FileHandler(session, 'a', 'utf-8')],
format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
level=logging.DEBUG)
logger = logging.getLogger()
Code in app:
Normally, debug-level info, but now using ‘error’ level:
logger.error(f"User: {self.user}, Widget values - ticker: {self.ticker.value}, window: {self.window.value}, norm: {self.norm.value}, nr. of reloads: {self.reload.clicks}")
Logging of actual errors:
self.plot_pane.object = hv.Div(f"Error: {e}")
logger.error(f"User: {self.user}, Error: {e}",exc_info=True)
Log looks like this:
2020-08-14 14:54:58,965 Running in --dev mode. --num-procs is limited to 1.
2020-08-14 14:54:58,965 Starting Bokeh server version 2.1.1 (running on Tornado 6.0.4)
2020-08-14 14:54:58,966 Cannot start Bokeh server, port 5006 is already in use
2020-08-14 14:55:56,659 Running in --dev mode. --num-procs is limited to 1.
2020-08-14 14:55:56,660 Starting Bokeh server version 2.1.1 (running on Tornado 6.0.4)
2020-08-14 14:55:56,661 Keep-alive ping configured every 30000 milliseconds
2020-08-14 14:55:56,661 Log statistics every 300000 milliseconds
2020-08-14 14:55:56,669 Log memory usage every 300000 milliseconds
2020-08-14 14:55:56,669 User authentication hooks provided (no default user)
2020-08-14 14:55:56,669 These host origins can connect to the websocket: ['dev.materialindicators.com:80']
2020-08-14 14:55:56,669 Patterns are:
2020-08-14 14:55:56,670 [('/MI_App_RC1-Copy5_1D/?',
2020-08-14 14:55:56,670 <class 'bokeh.server.views.doc_handler.DocHandler'>,
2020-08-14 14:55:56,670 {'application_context': <bokeh.server.contexts.ApplicationContext object at 0x7fd095ab8e90>,
2020-08-14 14:55:56,670 'bokeh_websocket_path': '/MI_App_RC1-Copy5_1D/ws'}),
2020-08-14 14:55:56,670 ('/MI_App_RC1-Copy5_1D/ws',
2020-08-14 14:55:56,670 <class 'bokeh.server.views.ws.WSHandler'>,
2020-08-14 14:55:56,670 {'application_context': <bokeh.server.contexts.ApplicationContext object at 0x7fd095ab8e90>,
2020-08-14 14:55:56,670 'bokeh_websocket_path': '/MI_App_RC1-Copy5_1D/ws'}),
2020-08-14 14:55:56,670 ('/MI_App_RC1-Copy5_1D/metadata',
2020-08-14 14:55:56,670 <class 'bokeh.server.views.metadata_handler.MetadataHandler'>,
2020-08-14 14:55:56,670 {'application_context': <bokeh.server.contexts.ApplicationContext object at 0x7fd095ab8e90>,
2020-08-14 14:55:56,670 'bokeh_websocket_path': '/MI_App_RC1-Copy5_1D/ws'}),
2020-08-14 14:55:56,670 ('/MI_App_RC1-Copy5_1D/autoload.js',
2020-08-14 14:55:56,670 <class 'bokeh.server.views.autoload_js_handler.AutoloadJsHandler'>,
2020-08-14 14:55:56,670 {'application_context': <bokeh.server.contexts.ApplicationContext object at 0x7fd095ab8e90>,
2020-08-14 14:55:56,670 'bokeh_websocket_path': '/MI_App_RC1-Copy5_1D/ws'}),
2020-08-14 14:55:56,670 ('/login',
2020-08-14 14:55:56,670 <class 'bokeh.auth_8ec79fca25a242ed9ff6fd68055e3f72.LoginHandler'>),
2020-08-14 14:55:56,670 ('/logout',
2020-08-14 14:55:56,670 <class 'bokeh.auth_8ec79fca25a242ed9ff6fd68055e3f72.LogoutHandler'>),
2020-08-14 14:55:56,670 ('/?',
2020-08-14 14:55:56,670 <class 'bokeh.server.views.root_handler.RootHandler'>,
2020-08-14 14:55:56,670 {'applications': {'/MI_App_RC1-Copy5_1D': <bokeh.server.contexts.ApplicationContext object at 0x7fd095ab8e90>},
2020-08-14 14:55:56,670 'index': '/root/anaconda3/lib/python3.7/site-packages/panel/io/../_templates/index.html',
2020-08-14 14:55:56,671 'prefix': '',
2020-08-14 14:55:56,671 'use_redirect': True}),
2020-08-14 14:55:56,671 ('/static/extensions/(.*)',
2020-08-14 14:55:56,671 <class 'bokeh.server.views.multi_root_static_handler.MultiRootStaticHandler'>,
2020-08-14 14:55:56,671 {'root': {}}),
2020-08-14 14:55:56,671 ('/static/(.*)',
2020-08-14 14:55:56,671 <class 'bokeh.server.views.static_handler.StaticHandler'>)]
2020-08-14 14:55:56,673 Bokeh app running at: http://localhost:5006/MI_App_RC1-Copy5_1D
2020-08-14 14:55:56,673 Starting Bokeh server with process id: 2349
2020-08-14 14:56:07,668 User: Mtrl_Scientist, Widget values - ticker: None, window: 1D, norm: ['Normalize CVD'], nr. of reloads: 1
2020-08-14 14:56:09,679 User: Mtrl_Scientist, Widget values - ticker: None, window: 1D, norm: ['Normalize CVD'], nr. of reloads: 2
2020-08-14 14:59:56,858 User: Mtrl_Scientist, Widget values - ticker: None, window: 1D, norm: ['Normalize CVD'], nr. of reloads: 3
2020-08-14 15:00:05,341 User: Mtrl_Scientist, Widget values - ticker: BTC_USDT, window: 1D, norm: ['Normalize CVD'], nr. of reloads: 3
2020-08-14 15:00:09,190 User: Mtrl_Scientist, Widget values - ticker: BTC_USDT, window: 3Y, norm: ['Normalize CVD'], nr. of reloads: 3
2020-08-14 15:00:13,475 User: Mtrl_Scientist, Widget values - ticker: ENJ_BTC, window: 3Y, norm: ['Normalize CVD'], nr. of reloads: 3
2020-08-14 15:00:17,343 User: Mtrl_Scientist, Widget values - ticker: SNGLS_BTC, window: 3Y, norm: ['Normalize CVD'], nr. of reloads: 3
2020-08-14 15:00:20,762 User: Mtrl_Scientist, Widget values - ticker: SNM_BTC, window: 3Y, norm: ['Normalize CVD'], nr. of reloads: 3
The logger within the app is configured to write to a different directory. This works properly whenever I use the app within Jupyter. But once I serve via Panel and use ‘–log-file webapp_RC1.log’, no more logs are saved to the in-app logger file.
Instead, the Panel logger takes over and saves only error-level events.
Also, the following log parameters seem to have no effect:
--stats-log-frequency 300000 --mem-log-frequency 300000
As they are not showing up in the log.
For now, you can just set the logger level to ‘error’, but I think this may be a bug.