Package jetbrains.buildServer.util.impl
Class TCLogStatistic
- java.lang.Object
-
- jetbrains.buildServer.util.impl.TCLogStatistic
-
public class TCLogStatistic extends java.lang.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(java.lang.String appenderName, LogEvent event, java.lang.String logFileName, <any> layout)
Add event to statisticsjava.util.List<java.lang.String>
getCaptureErrorMessages()
Get last error messagejava.util.Date
getLastErrorTime()
Get last error timejava.lang.String
getLogFileName()
Get log file name with last errorIntervalStatistic
getStatistic()
Get actual statisticstatic TCLogStatistic
init(LogEvent event, java.lang.String appenderName, java.lang.String logFileName, TimeService timeService, java.lang.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(LogEvent event)
static void
remove()
void
rollOver(java.lang.String appenderName, java.lang.String logFileName, int backupIndex)
Change the file name if log4j wants to rotate log files
-
-
-
Method Detail
-
init
@Nullable public static TCLogStatistic init(@NotNull LogEvent event, @Nullable java.lang.String appenderName, @Nullable java.lang.String logFileName, @NotNull TimeService timeService, @Nullable java.lang.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 LogEvent event)
-
remove
public static void remove()
-
add
public void add(@Nullable java.lang.String appenderName, @NotNull LogEvent event, @NotNull java.lang.String logFileName, @Nullable <any> layout)
Add event to statistics- Parameters:
appenderName
- appender created eventevent
- new eventlogFileName
- log file namelayout
-
-
getLogFileName
@Nullable public java.lang.String getLogFileName()
Get log file name with last error- Returns:
- log file name with last error
-
getCaptureErrorMessages
@Nullable public java.util.List<java.lang.String> getCaptureErrorMessages()
Get last error message- Returns:
- last error message
-
getStatistic
@NotNull public IntervalStatistic getStatistic()
Get actual statistic- Returns:
- actual statistic
-
getLastErrorTime
@Nullable public java.util.Date getLastErrorTime()
Get last error time- Returns:
- last error time
-
rollOver
public void rollOver(@Nullable java.lang.String appenderName, @NotNull java.lang.String logFileName, int backupIndex)
Change the file name if log4j wants to rotate log files- Parameters:
appenderName
- rotated appenderlogFileName
- orig file name
-
-