def install_handler(self, app):
        """Install log handler on Flask application."""
        # Check if directory exists.
        basedir = dirname(app.config['LOGGING_FS_LOGFILE'])
        if not exists(basedir):
            raise ValueError(
                'Log directory {0} does not exists.'.format(basedir))

        handler = RotatingFileHandler(
            app.config['LOGGING_FS_LOGFILE'],
            backupCount=app.config['LOGGING_FS_BACKUPCOUNT'],
            maxBytes=app.config['LOGGING_FS_MAXBYTES'],
            delay=True,
        )
        handler.setFormatter(logging.Formatter(
            '%(asctime)s %(levelname)s: %(message)s '
            '[in %(pathname)s:%(lineno)d]'
        ))
        handler.setLevel(app.config['LOGGING_FS_LEVEL'])

        # Add handler to application logger
        app.logger.addHandler(handler)

        if app.config['LOGGING_FS_PYWARNINGS']:
            self.capture_pywarnings(handler)

        # Add request_id to log record
        app.logger.addFilter(add_request_id_filter)
Install log handler on Flask application.