public void log(LogRecord record) {
    if (logToFile != null) {
      logToFile(record);
    }

    if (ignoreLogging) return;

    CapedwarfRequestLogs requestLogs = getCurrentRequestLogs();
    if (requestLogs != null) {
      CapedwarfAppLogLine capedwarfAppLogLine =
          new CapedwarfAppLogLine(getCurrentRequestId(), record.getSequenceNumber());
      AppLogLine appLogLine = capedwarfAppLogLine.getAppLogLine();
      appLogLine.setLogLevel(getLogLevel(record));
      appLogLine.setLogMessage(
          record.getSourceClassName()
              + " "
              + record.getSourceMethodName()
              + ": "
              + getFormattedMessage(record)
              + "\n");
      appLogLine.setTimeUsec(record.getMillis() * 1000);
      logWriter.put(capedwarfAppLogLine);

      requestLogs.logLineAdded(appLogLine);
      logWriter.put(requestLogs);
    }
  }
  @SuppressWarnings("unchecked")
  private void fetchAppLogLines(RequestLogs requestLogs, CapedwarfLogQuery logQuery) {
    CacheQuery query = createAppLogLinesQuery(requestLogs);
    //        FetchOptions fetchOptions = createAppLogFetchOptions(logQuery);

    List<CapedwarfAppLogLine> capedwarfAppLogLines =
        (List<CapedwarfAppLogLine>) (List) query.list();
    for (CapedwarfAppLogLine capedwarfAppLogLine : capedwarfAppLogLines) {
      requestLogs.getAppLogLines().add(capedwarfAppLogLine.getAppLogLine());
    }
  }