Get container logs.

        This method does not support streaming, use :meth:`stream_logs` for
        that.
965213
def get_logs(self, stdout=True, stderr=True, timestamps=False, tail='all',
                 since=None):
        
        return self.inner().logs(
            stdout=stdout, stderr=stderr, timestamps=timestamps, tail=tail,
            since=since)
948693
def lines(self):
        
        if self.cache_content and self.cached_content:
            return self.cached_content.splitlines(True)

        try:
            with self._open_dockerfile('rb') as dockerfile:
                lines = [b2u(l) for l in dockerfile.readlines()]
                if self.cache_content:
                    self.cached_content = ''.join(lines)
                return lines
        except (IOError, OSError) as ex:
            logger.error("Couldn't retrieve lines from dockerfile: %r", ex)
            raise
1324237
def _get_log(self):
        

        result = yield from self.manager.query("GET", "containers/{}/logs".format(self._cid), params={"stderr": 1, "stdout": 1})
        return result
642886
def get_log_lines(self, source_id, scan_id):
        
        target_url = self.client.get_url('SCAN', 'GET', 'log', {'source_id': source_id, 'scan_id': scan_id})
        r = self.client.request('GET', target_url, headers={'Accept': 'text/plain'}, stream=True)
        return r.iter_lines(decode_unicode=True)
864950
def get_log_lines(self):
        
        rel = self._client.reverse_url('SCAN', self.url)
        return self._manager.get_log_lines(**rel)
887108
public java.util.List<LogStream> getLogStreams() {
        if (logStreams == null) {
            logStreams = new com.amazonaws.internal.SdkInternalList<LogStream>();
        }
        return logStreams;
    }
614809
def get_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE):
    """"""
    self.fetch_logs(unique_id, logs, directory, pattern)
1035698
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0):
        
        log_name = '/aws/lambda/' + lambda_name
        streams = self.logs_client.describe_log_streams(
            logGroupName=log_name,
            descending=True,
            orderBy='LastEventTime'
        )

        all_streams = streams['logStreams']
        all_names = [stream['logStreamName'] for stream in all_streams]

        events = []
        response = {}
        while not response or 'nextToken' in response:
            extra_args = {}
            if 'nextToken' in response:
                extra_args['nextToken'] = response['nextToken']

            # Amazon uses millisecond epoch for some reason.
            # Thanks, Jeff.
            start_time = start_time * 1000
            end_time = int(time.time()) * 1000

            response = self.logs_client.filter_log_events(
                logGroupName=log_name,
                logStreamNames=all_names,
                startTime=start_time,
                endTime=end_time,
                filterPattern=filter_pattern,
                limit=limit,
                interleaved=True, # Does this actually improve performance?
                **extra_args
            )
            if response and 'events' in response:
                events += response['events']

        return sorted(events, key=lambda k: k['timestamp'])
759315
def get_log_entries(self, start_date=None, end_date=None, filters=list(),
                        limit=None):
        '''
        
        '''
        query = text_helper.format_block('''
        SELECT "localhost",
               logs.message,
               logs.level,
               logs.category,
               logs.log_name,
               logs.file_path,
               logs.line_num,
               logs.timestamp
        FROM logs
        WHERE 1
        ''')
        query = self._add_timestamp_condition_sql(query, start_date, end_date)

        def transform_filter(filter):
            level = filter.get('level', None)
            category = filter.get('category', None)
            name = filter.get('name', None)
            if level is None:
                raise AttributeError("level is mandatory parameter.")
            resp = "(logs.level <= %d" % (int(level), )
            if category is not None:
                resp += " AND logs.category == '%s'" % (category, )
            if name is not None:
                resp += " AND logs.log_name == '%s'" % (name, )
            resp += ')'
            return resp

        filter_strings = map(transform_filter, filters)
        if filter_strings:
            query += " AND (%s)\n" % (' OR '.join(filter_strings), )
        query += " ORDER BY logs.timestamp, rowid"
        if limit:
            query += " LIMIT %s" % (limit, )

        d = self._db.runQuery(query)
        d.addCallback(self._decode, entry_type='log')
        return d
1315539
def get_logs(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.LogList(self._results, runtime=self._runtime)
930307
def get_log(self):
        
        if self._lookup_session is None:
            mgr = get_provider_manager('LOGGING', runtime=self._runtime, proxy=self._proxy)
            self._lookup_session = mgr.get_log_lookup_session(proxy=getattr(self, "_proxy", None))
        return self._lookup_session.get_log(Id(self._my_map['id']))
1328749
def get_registered_loggers(hide_children=False, hide_reusables=False):
    

    return [logger for logger in logging.Logger.manager.loggerDict.keys()
            if not (hide_reusables and "reusables" in logger)
            and not (hide_children and "." in logger)]
1120373
def get_logger(name=None):
    '''
    
    '''
    logger = logging.getLogger(name)
    if len(logger.handlers) == 0:
        logger = add_stream_handler(logger)
    return logger
1219472
def attach_log_stream(self):
        
        if self.has_api_logs:
            self.log_stream = self.attach(stdout=True, stderr=True, stream=True)
186162
def get_logs(self, container_id):
        
        stdout = self._docker.containers.get(container_id).logs(stdout=True, stderr=False).decode('utf8')
        stderr = self._docker.containers.get(container_id).logs(stdout=False, stderr=True).decode('utf8')
        return stdout, stderr
801685
def cdn_metadata
      log "retrieving container CDN metadata from #{container_path}"
      response = cdn_client.head(container_path)
      {
        :cdn_enabled => response["X-CDN-Enabled"] == "True",
        :host => response["X-CDN-URI"],
        :ssl_host => response["X-CDN-SSL-URI"],
        :streaming_host => response["X-CDN-STREAMING-URI"],
        :ttl => response["X-TTL"].to_i,
        :log_retention => response["X-Log-Retention"] == "True"
      }
    end
849764
def get_logs(self):
        

        output = []

        # Collect logs from server
        try:
            logs = self.osbs.get_build_logs(self.build_id)
        except OsbsException as ex:
            self.log.error("unable to get build logs: %r", ex)
        else:
            # Deleted once closed
            logfile = NamedTemporaryFile(prefix=self.build_id,
                                         suffix=".log",
                                         mode='wb')
            try:
                logfile.write(logs)
            except (TypeError, UnicodeEncodeError):
                # Older osbs-client versions returned Unicode objects
                logfile.write(logs.encode('utf-8'))
            logfile.flush()
            metadata = self.get_output_metadata(logfile.name,
                                                "openshift-final.log")
            output.append(Output(file=logfile, metadata=metadata))

        docker_logs = NamedTemporaryFile(prefix="docker-%s" % self.build_id,
                                         suffix=".log",
                                         mode='wb')
        docker_logs.write("\n".join(self.workflow.build_result.logs).encode('utf-8'))
        docker_logs.flush()
        output.append(Output(file=docker_logs,
                             metadata=self.get_output_metadata(docker_logs.name,
                                                               "build.log")))
        return output