jina.logging.logger module

class jina.logging.logger.SysLogHandlerWrapper(address=('localhost', 514), facility=1, socktype=None)[source]

Bases: logging.handlers.SysLogHandler

Override the priority_map SysLogHandler.

Warning

This messages at DEBUG and INFO are therefore not stored by ASL, (ASL = Apple System Log) which in turn means they can’t be printed by syslog after the fact. You can confirm it via syslog or tail -f /var/log/system.log.

Initialize a handler.

If address is specified as a string, a UNIX socket is used. To log to a local syslogd, “SysLogHandler(address=”/dev/log”)” can be used. If facility is not specified, LOG_USER is used. If socktype is specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific socket type will be used. For Unix sockets, you can also specify a socktype of None, in which case socket.SOCK_DGRAM will be used, falling back to socket.SOCK_STREAM.

priority_map = {'CRITICAL': 'critical', 'DEBUG': 'debug', 'ERROR': 'error', 'INFO': 'info', 'WARNING': 'warning'}
class jina.logging.logger.JinaLogger(context, name=None, log_config=None, identity=None, workspace_path=None, quiet=False, **kwargs)[source]

Bases: object

Build a logger for a context.

Parameters
  • context (str) – The context identifier of the class, module or method.

  • log_config (Optional[str]) – The configuration file for the logger.

  • identity (Optional[str]) – The id of the group the messages from this logger will belong, used by fluentd default

configuration to group logs by pod. :type workspace_path: Optional[str] :param workspace_path: The workspace path where the log will be stored at (only apply to fluentd) :return:: an executor object.

supported = {'FileHandler', 'FluentHandler', 'StreamHandler', 'SysLogHandler'}
property handlers

Get the handlers of the logger.

Return:

Handlers of logger.

close()[source]

Close all the handlers.

add_handlers(config_path=None, **kwargs)[source]

Add handlers from config file.

Parameters
  • config_path (Optional[str]) – Path of config file.

  • kwargs – Extra parameters.