Package jetbrains.buildServer.util.impl
Class TCLogStatistic
- java.lang.Object
-
- jetbrains.buildServer.util.impl.TCLogStatistic
-
public class TCLogStatistic extends Object
Class for keeping up-to-date statistics from log4j appender Attention: singleton. Can be changed to a class with state
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String appenderName, org.apache.logging.log4j.core.LogEvent event, String logFileName, org.apache.logging.log4j.core.Layout<? extends Serializable> layout)
Add event to statisticsList<String>
getCaptureErrorMessages()
Get last error messageDate
getLastErrorTime()
Get last error timeString
getLogFileName()
Get log file name with last errorIntervalStatistic
getStatistic()
Get actual statisticstatic TCLogStatistic
init(org.apache.logging.log4j.core.LogEvent event, String appenderName, String logFileName, TimeService timeService, String periods)
Create a new instance if the instance is not created or change current instance or do nothing if the log level is low or do nothing if the appender is not being trackedstatic boolean
isEnabledForEvent(org.apache.logging.log4j.core.LogEvent event)
static void
remove()
void
rollOver(String appenderName, String logFileName, int backupIndex)
Change the file name if log4j wants to rotate log files
-
-
-
Method Detail
-
init
@Nullable public static TCLogStatistic init(@NotNull org.apache.logging.log4j.core.LogEvent event, @Nullable String appenderName, @Nullable String logFileName, @NotNull TimeService timeService, @Nullable String periods)
Create a new instance if the instance is not created or change current instance or do nothing if the log level is low or do nothing if the appender is not being tracked- Parameters:
event
- log event with log levelappenderName
- appender created eventlogFileName
- the file contains a eventtimeService
- time service, it will be used to obtain current timeperiods
- observed time intervals. configuration with ";" delimiter, like "10m; 1h; 1d; 30d; 1y"- Returns:
- new or old instance
-
isEnabledForEvent
public static boolean isEnabledForEvent(@NotNull org.apache.logging.log4j.core.LogEvent event)
-
remove
public static void remove()
-
add
public void add(@Nullable String appenderName, @NotNull org.apache.logging.log4j.core.LogEvent event, @NotNull String logFileName, @Nullable org.apache.logging.log4j.core.Layout<? extends Serializable> layout)
Add event to statistics- Parameters:
appenderName
- appender created eventevent
- new eventlogFileName
- log file namelayout
-
-
getLogFileName
@Nullable public String getLogFileName()
Get log file name with last error- Returns:
- log file name with last error
-
getCaptureErrorMessages
@Nullable public List<String> getCaptureErrorMessages()
Get last error message- Returns:
- last error message
-
getStatistic
@NotNull public IntervalStatistic getStatistic()
Get actual statistic- Returns:
- actual statistic
-
getLastErrorTime
@Nullable public Date getLastErrorTime()
Get last error time- Returns:
- last error time
-
-