Class BuildLoggerImpl
- java.lang.Object
-
- com.atlassian.bamboo.build.logger.AbstractBuildLogger
-
- com.atlassian.bamboo.build.logger.BuildLoggerImpl
-
- All Implemented Interfaces:
BuildLogger
,BuildLoggerWithoutLogAccess
,FileWritingBuildLogger
public class BuildLoggerImpl extends AbstractBuildLogger implements FileWritingBuildLogger
-
-
Field Summary
Fields Modifier and Type Field Description protected ExpiryTicker
expiryTicker
-
Fields inherited from class com.atlassian.bamboo.build.logger.AbstractBuildLogger
MAX_BUILDLOG_SIZE
-
-
Constructor Summary
Constructors Constructor Description BuildLoggerImpl(LoggerId<? extends Key> loggerId, @NotNull ExpiryTicker expiryTicker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull String
addBuildLogEntry(@NotNull LogEntry entry)
Add a new build log entry.@NotNull String
addErrorLogEntry(@NotNull LogEntry entry)
Add a new build error log entry.String
addRemoteBuildLogEntry(@NotNull LogEntry entry, boolean needToPersistOnTarget, boolean addedAfterLogSpoolClosed)
String
addRemoteErrorLogEntry(@NotNull LogEntry entry, boolean needToPersistOnTarget, boolean addedAfterLogSpoolClosed)
void
flush()
void
handleRemoteLogFile(@NotNull File logFile, @NotNull File remoteLogFile)
Replace underlying log file with the remote log.boolean
isPersistent()
void
onAddLogEntry(@NotNull LogEntry logEntry)
void
stopStreamingBuildLogs()
Stop streaming any logs to the build logs filevoid
switchPersistence(boolean persistent)
-
Methods inherited from class com.atlassian.bamboo.build.logger.AbstractBuildLogger
addBuildLogEntry, addErrorLogEntry, addErrorLogEntry, addErrorLogEntryInternal, addLogEntry, close, getBuildLog, getErrorLog, getInterceptorStack, getLastNLogEntries, getLogEntryCount, getMutatorStack, getTimeOfLastLog, interceptAndMutate, interceptAndMutateError, setTimeOfLastLog
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.build.logger.BuildLogger
getLastNLogEntries, getLogEntryCount
-
Methods inherited from interface com.atlassian.bamboo.build.logger.BuildLoggerWithoutLogAccess
addBuildLogEntry, addErrorLogEntry, addErrorLogEntry, close, getInterceptorStack, getMutatorStack, getTimeOfLastLog, setTimeOfLastLog, transfersLogsAsArtifact
-
-
-
-
Field Detail
-
expiryTicker
protected final ExpiryTicker expiryTicker
-
-
Constructor Detail
-
BuildLoggerImpl
public BuildLoggerImpl(LoggerId<? extends Key> loggerId, @NotNull @NotNull ExpiryTicker expiryTicker)
-
-
Method Detail
-
addRemoteBuildLogEntry
public String addRemoteBuildLogEntry(@NotNull @NotNull LogEntry entry, boolean needToPersistOnTarget, boolean addedAfterLogSpoolClosed)
- Specified by:
addRemoteBuildLogEntry
in interfaceFileWritingBuildLogger
-
addRemoteErrorLogEntry
public String addRemoteErrorLogEntry(@NotNull @NotNull LogEntry entry, boolean needToPersistOnTarget, boolean addedAfterLogSpoolClosed)
- Specified by:
addRemoteErrorLogEntry
in interfaceFileWritingBuildLogger
-
addBuildLogEntry
@NotNull public @NotNull String addBuildLogEntry(@NotNull @NotNull LogEntry entry)
Description copied from interface:BuildLoggerWithoutLogAccess
Add a new build log entry. This will get appended to the end of the log.- Specified by:
addBuildLogEntry
in interfaceBuildLoggerWithoutLogAccess
- Overrides:
addBuildLogEntry
in classAbstractBuildLogger
- Parameters:
entry
- The data being logged- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
addErrorLogEntry
@NotNull public @NotNull String addErrorLogEntry(@NotNull @NotNull LogEntry entry)
Description copied from interface:BuildLoggerWithoutLogAccess
Add a new build error log entry. This will get appended to the end of the log and to the end of the errors.- Specified by:
addErrorLogEntry
in interfaceBuildLoggerWithoutLogAccess
- Overrides:
addErrorLogEntry
in classAbstractBuildLogger
- Parameters:
entry
- The data being logged- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
switchPersistence
public void switchPersistence(boolean persistent)
-
onAddLogEntry
public void onAddLogEntry(@NotNull @NotNull LogEntry logEntry)
- Specified by:
onAddLogEntry
in classAbstractBuildLogger
-
stopStreamingBuildLogs
public void stopStreamingBuildLogs()
Description copied from interface:BuildLoggerWithoutLogAccess
Stop streaming any logs to the build logs file- Specified by:
stopStreamingBuildLogs
in interfaceBuildLoggerWithoutLogAccess
- Specified by:
stopStreamingBuildLogs
in classAbstractBuildLogger
-
flush
public void flush()
-
isPersistent
public boolean isPersistent()
- Specified by:
isPersistent
in interfaceBuildLoggerWithoutLogAccess
- Returns:
- true if underlying logger saves to disk
-
handleRemoteLogFile
public void handleRemoteLogFile(@NotNull @NotNull File logFile, @NotNull @NotNull File remoteLogFile) throws IOException
Description copied from interface:FileWritingBuildLogger
Replace underlying log file with the remote log. If not possible, then append. Stop accepting live logs from remote agent.- Specified by:
handleRemoteLogFile
in interfaceFileWritingBuildLogger
- Throws:
IOException
-
-