use of hudson.logging.LogRecorder in project support-core-plugin by jenkinsci.
the class JenkinsLogs method addLogRecorders.
/**
* 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.
*/
private void addLogRecorders(Container result) {
for (Map.Entry<String, LogRecorder> entry : logRecorders.entrySet()) {
String name = entry.getKey();
String entryName = "nodes/master/logs/custom/" + name + ".log";
File storedFile = new File(customLogs, name + ".log");
if (storedFile.isFile()) {
result.add(new FileContent(entryName, storedFile));
} else {
// Was not stored for some reason; fine, just load the memory buffer.
final LogRecorder recorder = entry.getValue();
result.add(new LogRecordContent(entryName) {
@Override
public Iterable<LogRecord> getLogRecords() {
return recorder.getLogRecords();
}
});
}
}
}
Aggregations