Gets the logs through plain text stream to reduce memory overhead.
197928
private void ajaxFetchExecFlowLogs(final HttpServletRequest req,
      final HttpServletResponse resp, final HashMap<String, Object> ret, final User user,
      final ExecutableFlow exFlow) throws ServletException {
    final long startMs = System.currentTimeMillis();
    final Project project = getProjectAjaxByPermission(ret, exFlow.getProjectId(), user, Type.READ);
    if (project == null) {
      return;
    }

    final int offset = this.getIntParam(req, "offset");
    final int length = this.getIntParam(req, "length");

    resp.setCharacterEncoding("utf-8");

    try {
      final LogData data = this.executorManagerAdapter.getExecutableFlowLog(exFlow, offset, length);
      ret.putAll(appendLogData(data, offset));

    } catch (final ExecutorManagerException e) {
      throw new ServletException(e);
    }

    /*
     * We originally consider leverage Drop Wizard's Timer API {@link com.codahale.metrics.Timer}
     * to measure the duration time.
     * However, Timer will result in too many accompanying metrics (e.g., min, max, 99th quantile)
     * regarding one metrics. We decided to use gauge to do that and monitor how it behaves.
     */
    this.webMetrics.setFetchLogLatency(System.currentTimeMillis() - startMs);
  }
95793
async function readLogStream(file, instance) {
    return new Promise(resolve => {
        var stream = fs.createReadStream(file, { encoding: 'utf8', highWaterMark: instance.chunkSize });
        var hasStarted = false;
        // Split data into chunks so we dont stall the client
        stream.on('data', chunk => {
            if (!hasStarted) instance.emit("parsingStarted");
            hasStarted = true;
            var lines = chunk.toString().split("\n");
            // Pause stream until this chunk is completed to avoid spamming the thread
            stream.pause();
            async.each(lines, function (line, callback) {
                instance.registerMatch(line);
                callback();
            }, function (err) {
                setTimeout(() => {
                    stream.resume();
                }, instance.chunkInterval);
            });
        });
        stream.on('end', () => {
            instance.emit("parsingComplete");
            resolve();
            stream.close();
        });
    });
}
735646
def get_log_stream(logger):
    

    file_stream = None
    log_stream = None
    for handler in logger.handlers:
        if isinstance(handler, logging.FileHandler):
            file_stream = handler.stream
        else:
            log_stream = handler.stream

    if file_stream:
        return file_stream

    return log_stream
637806
public Log getLog(Class<?> clazz) {
		Log log = logCache.get(clazz);
		if (null == log) {
			log = createLog(clazz);
			logCache.put(clazz, log);
		}
		return log;
	}
1172241
def files_log_graph(self, stream):
        '''  '''
        file_log = list(stream)
        print 'Entering file_log_graph...(%d rows)' % len(file_log)
        for row in file_log:

            # If the mime-type is interesting add the uri and the host->uri->host relationships
            if row['mime_type'] not in self.exclude_mime_types:

                # Check for weird conditions
                if (row['total_bytes'] == '-'):
                    continue
                if ('-' in row['md5']):
                    continue

                # Check for missing bytes
                if row['missing_bytes']:
                    labels = ['file','missing']
                else:
                    labels = ['file']

                # Make the file node name kewl
                name = '%6s  %s  %.0f-KB' % (row['md5'][:6], row['mime_type'], row['total_bytes']/1024.0)
                if row['missing_bytes']:
                    name += '*'
                name = name.replace('application/','')

                # Add the file node
                self.add_node(row['md5'], name, labels)

                # Add the tx_host
                self.add_node(row['tx_hosts'], row['tx_hosts'], ['host'])

                # Add the file->tx_host relationship
                self.add_rel(row['tx_hosts'], row['md5'], 'file')
920480
def get_logs(self):
        
        assert BeautifulSoup, "Please install bs4 to use this method"

        url = self.base_url + "/system/syslog.lua"
        response = self.session.get(url, params={
            'sid': self.sid,
            'stylemode': 'print',
        }, timeout=15)
        response.raise_for_status()

        entries = []
        tree = BeautifulSoup(response.text)
        rows = tree.find('table').find_all('tr')
        for row in rows:
            columns = row.find_all("td")
            date = columns[0].string
            time = columns[1].string
            message = columns[2].find("a").string

            merged = "{} {} {}".format(date, time, message.encode("UTF-8"))
            msg_hash = hashlib.md5(merged).hexdigest()
            entries.append(LogEntry(date, time, message, msg_hash))
        return entries
1169278
def log_writer():
    ''''''
    while True:
        mpstate.logfile_raw.write(bytearray(mpstate.logqueue_raw.get()))
        timeout = time.time() + 10
        while not mpstate.logqueue_raw.empty() and time.time() < timeout:
            mpstate.logfile_raw.write(mpstate.logqueue_raw.get())
        while not mpstate.logqueue.empty() and time.time() < timeout:
            mpstate.logfile.write(mpstate.logqueue.get())
        if mpstate.settings.flushlogs or time.time() >= timeout:
            mpstate.logfile.flush()
            mpstate.logfile_raw.flush()
258469
public java.util.List<SearchedLogStream> getSearchedLogStreams() {
        if (searchedLogStreams == null) {
            searchedLogStreams = new com.amazonaws.internal.SdkInternalList<SearchedLogStream>();
        }
        return searchedLogStreams;
    }
846024
protected void writeLogging(Definition def, Writer out, int indent, String level, String content, String... params)
         throws IOException
   {
      writeIndent(out, indent);
      if (def.isSupportJbossLogging())
      {
         out.write("log.trace");
         int size = params.length;
         if (size > 0)
            out.write("f");
         out.write("(\"" + content + "(");
         for (int i = 0; i < size; i++)
         {
            out.write("%s");
            if (i < size - 1)
               out.write(", ");
         }
         out.write(")\"");
         for (int i = 0; i < size; i++)
         {
            out.write(", ");
            out.write(params[i]);
         }
         out.write(");");
      }
      else
      {
         out.write("log.finest(\"" + content + "()\");");
      }
      writeEol(out);
   }
1016983
private static synchronized StreamHandler getStreamHandler() {
    if (methodHandler == null) {
      methodHandler = new ConsoleHandler();
      methodHandler.setFormatter(new Formatter() {
        @Override
        public String format(LogRecord record) {
          return record.getMessage() + "\n";
        }
      });
      methodHandler.setLevel(Level.FINE);
    }
    return methodHandler;
  }
265576
function logentriesRawStream(pathname, query={}) {
    query = Object.assign({}, query);

    // If query format is not defined, we set it by default to JSON.
    if (!query.format) {
        query.format = 'json';
    }

    // Text format is default in Logentries, in this case we remove the parameter.
    if (query.format === 'text') {
        delete query.format;
    }

    // Put default start and/or end times, if not given.
    if (!query.start && !query.end) {
        query.end   = Date.now();
        query.start = query.end - 15*60*1000; // 15 minutes
    } else if (!query.start) {
        query.start = query.end - 15*60*1000;
    } else if (!query.end) {
        query.end = query.start + 15*60*1000;
    }

    // Return raw stream using the download API.
    return request.get({
        url     : url.format({
            protocol : 'https:',
            host     : 'pull.logentries.com',
            pathname : pathname,
            query    : query
        }),
        gzip    : true,
        timeout : 30000 // 30 seconds
    });
}
958307
public PlainChangesLog read(ObjectReader in) throws UnknownClassIdException, IOException
   {
      int key;
      if ((key = in.readInt()) != SerializationConstants.PLAIN_CHANGES_LOG_IMPL)
      {
         throw new UnknownClassIdException("There is unexpected class [" + key + "]");
      }
      int eventType = in.readInt();

      String sessionId = in.readString();

      List<ItemState> items = new ArrayList<ItemState>();
      int listSize = in.readInt();
      for (int i = 0; i < listSize; i++)
      {
         ItemStateReader isr = new ItemStateReader(holder, spoolConfig);
         ItemState is = isr.read(in);
         items.add(is);
      }

      return new PlainChangesLogImpl(items, sessionId, eventType);
   }
507661
function _getStreams (): Array<Stream> {
  const logLevel = process.env.LOG_LEVEL
  const level = parseInt(logLevel, 10) || logLevel || 'info'
  return [
    {
      level,
      stream: process.stdout
    }
  ]
}
1231025
public LogStreamResponse getLogs(String appName, Boolean tail) {
        return connection.execute(new Log(appName, tail), apiKey);
    }
1083556
def slowlog_get(self, length=None):
        """"""
        if length is not None:
            if not isinstance(length, int):
                raise TypeError("length must be int or None")
            return self.execute(b'SLOWLOG', b'GET', length)
        else:
            return self.execute(b'SLOWLOG', b'GET')
210017
private synchronized void precomputeLogs(int len) {
    if(len <= ilogs.length) {
      return; // Probably done by another thread.
    }
    double[] logs = Arrays.copyOf(ilogs, len);
    for(int i = ilogs.length; i < len; i++) {
      logs[i] = FastMath.log1p(i);
    }
    this.ilogs = logs;
  }
464461
def _logger_stream(self):
        """"""
        sh = logging.StreamHandler()
        sh.set_name('sh')
        sh.setLevel(logging.INFO)
        sh.setFormatter(self._logger_formatter)
        self.log.addHandler(sh)