Dumps the content of {@link LogRecorder}, which is the groups of loggers configured
by the user. The contents are also ring buffer and only remembers recent 256 or so entries.
518420
private void addLogRecorders(Container result) {
        for (Map.Entry<String, LogRecorder> entry : logRecorders.entrySet()) {
            String name = entry.getKey();
            String entryName = "nodes/master/logs/custom/{0}.log"; // name to be filtered in the bundle
            File storedFile = new File(customLogs, name + ".log");
            if (storedFile.isFile()) {
                result.add(new FileContent(entryName, new String[]{name}, storedFile));
            } else {
                // Was not stored for some reason; fine, just load the memory buffer.
                final LogRecorder recorder = entry.getValue();
                result.add(new LogRecordContent(entryName, new String[]{name}) {
                    @Override
                    public Iterable<LogRecord> getLogRecords() {
                        return recorder.getLogRecords();
                    }
                });
            }
        }
    }
839322
private void dumpCache(){
        if (CacheDumpLogger.isDebugEnabled()) {
            try {
                StringBuilder sb = new StringBuilder();
                sb.append("LookupManager dumped Service Cache at: ").append(System.currentTimeMillis()).append("\n");
                ModelService service = getData();
                sb.append(service==null ? "Cache is empty" : new String(serialize(service))).append("\n");
                CacheDumpLogger.debug(sb.toString());
            } catch (Exception e) {
                LOGGER.warn("Dump Service Cache failed. Set Logger {} to INFO to disable this message.",
                            CacheDumpLogger.getName());
                LOGGER.trace("Dump Service Cache failed. ", e);
            }
        }
    }
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()
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);
   }
225209
public synchronized void log(String formattedLog)
    {
        if (_reopen || _out==null)
        {
            stop();
            start();
        }
        try
        {
            _buffer.write(formattedLog);
            _buffer.write(StringUtil.__LINE_SEPARATOR);
            if (_flushOn || _buffer.size()>_bufferSize)
            {
                _buffer.writeTo(_out);
                _buffer.resetWriter();
                _out.flush();
            }
        }
        catch(IOException e){e.printStackTrace();}
    }
338218
public void log(Logger log)
    {
        // only print overflow if there is any
        int nameCount;
        if (buckets.get(buckets.length() - 1) == 0)
            nameCount = buckets.length() - 1;
        else
            nameCount = buckets.length();
        String[] names = new String[nameCount];

        int maxNameLength = 0;
        for (int i = 0; i < nameCount; i++)
        {
            names[i] = nameOfRange(bucketOffsets, i);
            maxNameLength = Math.max(maxNameLength, names[i].length());
        }

        // emit log records
        String formatstr = "%" + maxNameLength + "s: %d";
        for (int i = 0; i < nameCount; i++)
        {
            long count = buckets.get(i);
            // sort-of-hack to not print empty ranges at the start that are only used to demarcate the
            // first populated range. for code clarity we don't omit this record from the maxNameLength
            // calculation, and accept the unnecessary whitespace prefixes that will occasionally occur
            if (i == 0 && count == 0)
                continue;
            log.debug(String.format(formatstr, names[i], count));
        }
    }
41290
public function dumpTo(LoggerInterface $logger)
    {
        if (empty($this->sessionLog)) {
            return $this;
        }

        $logger->write(new LogRecord(null, "=== Detailed session log dump begin ==================", null));
        foreach ($this->sessionLog as $record) {
            $logger->write($record); // historical log dumped with actual event times
        }
        $logger->write(new LogRecord(null, "=== Detailed session log dump end ====================", null));

        return $this;
    }
325274
private static void publish(Logger logger, LogRecord record) {
    // Annoyingly this method appears to copy the array every time it is called, but there's
    // nothing much we can do about this (and there could be synchronization issues even if we
    // could access things directly because handlers can be changed at any time). Most of the
    // time this returns the singleton empty array however, so it's not as bad as all that.
    for (Handler handler : logger.getHandlers()) {
      handler.publish(record);
    }
    if (logger.getUseParentHandlers()) {
      logger = logger.getParent();
      if (logger != null) {
        publish(logger, record);
      }
    }
  }
307152
public synchronized void backupTrxLog(Object objMessage)
    {
        try {
            this.getWriter().writeObject(objMessage);
            m_lastWrite = System.currentTimeMillis();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
1329962
public void configLogger()
    {
        Map<String, Level> logLevels = new HashMap<String, Level>();
        logLevels.put("trace", Level.TRACE);
        logLevels.put("debug", Level.DEBUG);
        logLevels.put("info", Level.INFO);
        logLevels.put("warning", Level.WARNING);
        logLevels.put("error", Level.ERROR);

        if( this.get("logging_log_type", "file").equals("file") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName, (this.get("logging_buffered", "false").equals("true")) ? true : false, (this.get("logging_append", "true").equals("true")) ? true : false))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else if( this.get("logging_log_type", "file").equals("both") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .addWriter(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else{

            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }
    }
1318985
protected String format(LogRecord record)
  {
    if (! isLoggable(record)) {
      return null;
    }
    
    StringBuilder sb = new StringBuilder();
    
    if (record == null) {
      sb.append("no record");
          
      if (isNullDelimited()) {
        sb.append('\0');
      }

      return sb.toString();
    }

    try {
      Formatter formatter = getFormatter();
      
      if (formatter != null) {
        String value = formatter.format(record);
  
        sb.append(value).append('\n');
        
        if (isNullDelimited()) {
          sb.append('\0');
        }
          
        return sb.toString();
      }
        
      String message = record.getMessage();
      Throwable thrown = record.getThrown();
        
      if (thrown == null
          && message != null
          && message.indexOf("java.lang.NullPointerException") >= 0) {
        thrown = new IllegalStateException();
        thrown.fillInStackTrace();
      }
            
      if (thrown != null) {
        if (message != null
            && ! message.equals(thrown.toString()) 
            && ! message.equals(thrown.getMessage())) {
          printMessage(sb, message, record.getParameters());
        }
          
        StringWriter writer = new StringWriter();
        PrintWriter pw = new PrintWriter(writer);
        thrown.printStackTrace(pw);
        pw.close();
        
        sb.append(writer.toString());
      }
      else {
        printMessage(sb, message, record.getParameters());
      }

      /*
      TimestampFilter timestamp = getTimestampFilter();
      if (timestamp != null) {
        sb = timestamp.format(sb);
      }
      */
        
      if (isNullDelimited()) {
        sb.append('\0');
      }
    } catch (Throwable e) {
      e.printStackTrace();
    }

    return sb.toString();
  }
361307
private void dumpUsefulStuff(IncidentStream is, Object[] objs) {

    // The first parameter is a marker telling us what sort of data we have in subsequent
    // parameters.
    if (objs != null && objs.length > 0) {
      if (objs[0] == MfpConstants.DM_BUFFER && objs.length >= 4)
        dumpJmfBuffer(is, (byte[])objs[1], ((Integer)objs[2]).intValue(), ((Integer)objs[3]).intValue());
      else if (objs[0] == MfpConstants.DM_MESSAGE && objs.length >= 2)
        dumpJmfMessage(is, (JMFMessage)objs[1], objs[2]);
      else if (objs[0] == MfpConstants.DM_SLICES && objs.length >= 2)
        dumpJmfSlices(is, (List<DataSlice>)objs[1]);
    }

  }
1161589
public void anonymize() throws Exception {
    EventRecord er = null;
    SerializedRecord sr = null;

    BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName()
        + ".anonymized"));

    System.out.println("Anonymizing log records...");
    while ((er = parser.getNext()) != null) {
      if (er.isValid()) {
        sr = new SerializedRecord(er);
        Anonymizer.anonymize(sr);
        bfw.write(LocalStore.pack(sr).toString());
        bfw.write(LocalStore.RECORD_SEPARATOR);
      }
    }
    bfw.flush();
    bfw.close();
    System.out.println("Anonymized log records written to " + logfile.getName()
        + ".anonymized");

    System.out.println("Compressing output file...");
    LocalStore.zipCompress(logfile.getName() + ".anonymized");
    System.out.println("Compressed output file written to " + logfile.getName()
        + ".anonymized" + LocalStore.COMPRESSION_SUFFIX);
  }
210403
@Override
	public ReversibleIterator<BasicLogRecord> iterator() {
		logMgrLock.lock();
		try {
			flush();
			return new LogIterator(currentBlk);
		} finally {
			logMgrLock.unlock();
		}
	}
777577
public void log(LogRecord record) {
        if (record.getLevel().intValue() < levelValue || levelValue == offValue) {
            return;
        }
        Filter theFilter = filter;
        if (theFilter != null && !theFilter.isLoggable(record)) {
            return;
        }

        // Post the LogRecord to all our Handlers, and then to
        // our parents' handlers, all the way up the tree.

        Logger logger = this;
        while (logger != null) {
            for (Handler handler : logger.getHandlers()) {
                handler.publish(record);
            }

            if (!logger.getUseParentHandlers()) {
                break;
            }

            logger = logger.getParent();
        }
    }
808952
public void save(OnSaveLogListener listener) {
        File dir = getLogDir();

        if (dir == null) {
            listener.onError("Can't save logs. External storage is not mounted. " +
                "Check android.permission.WRITE_EXTERNAL_STORAGE permission");
            return;
        }

        FileWriter fileWriter = null;

        try {
            File output = new File(dir, getLogFileName());
            fileWriter = new FileWriter(output, true);

            List<LogEntry> entries = bufferedLogs();
            for (LogEntry entry : entries) {
                fileWriter.write(entry.prettyPrint() + "\n");
            }

            listener.onSave(output);

        } catch (IOException e) {
            listener.onError(e.getMessage());
            e.printStackTrace();

        } finally {
            if (fileWriter != null) {
                try {
                    fileWriter.close();
                } catch (IOException e) {
                    listener.onError(e.getMessage());
                    e.printStackTrace();
                }
            }
        }
    }
896532
@SuppressWarnings("UnusedDeclaration") public void dump() {
    Buffer buffer = new Buffer();
    try {
      dump(buffer);
    } catch (IOException e) {
      throw new AssertionError(e);
    }
    Log.i(TAG, buffer.readUtf8());
  }