Package org.xwiki.logging
Class LogQueue
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.ConcurrentLinkedQueue<LogEvent>
-
- org.xwiki.logging.LogQueue
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Iterable<LogEvent>
,Collection<LogEvent>
,Queue<LogEvent>
,org.slf4j.Logger
,Logger
,LoggerTail
,LogTail
public class LogQueue extends ConcurrentLinkedQueue<LogEvent> implements LoggerTail
A queue ofLogEvent
s.- Since:
- 3.2M3
- Version:
- $Id: 8b3b3240411c166b0cd06a69c33b2a85f54afc70 $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.xwiki.logging.Logger
ROOT_MARKER
-
-
Constructor Summary
Constructors Constructor Description LogQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LogEvent
addLogEvent(org.slf4j.Marker marker, LogLevel level, String format, Object[] arguments)
LogEvent
addLogEvent(org.slf4j.Marker marker, LogLevel level, String format, Object[] arguments, Throwable throwable)
LogEvent
addLogEvent(LogLevel level, String format, Object[] arguments)
LogEvent
addLogEvent(LogLevel level, String format, Object[] arguments, Throwable throwable)
void
close()
boolean
containLogsFrom(LogLevel level)
Indicate if the list contains logs of a specific level.void
debug(String msg)
void
debug(String format, Object arg)
void
debug(String format, Object... arguments)
void
debug(String format, Object arg1, Object arg2)
void
debug(String msg, Throwable t)
void
debug(org.slf4j.Marker marker, String msg)
void
debug(org.slf4j.Marker marker, String format, Object arg)
void
debug(org.slf4j.Marker marker, String format, Object... arguments)
void
debug(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
void
debug(org.slf4j.Marker marker, String msg, Throwable t)
void
error(String msg)
void
error(String format, Object arg)
void
error(String format, Object... arguments)
void
error(String format, Object arg1, Object arg2)
void
error(String msg, Throwable t)
void
error(org.slf4j.Marker marker, String msg)
void
error(org.slf4j.Marker marker, String format, Object arg)
void
error(org.slf4j.Marker marker, String format, Object... arguments)
void
error(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
void
error(org.slf4j.Marker marker, String msg, Throwable t)
void
flush()
Force writing and wait for any writing to be finished.LogEvent
getFirstLogEvent(LogLevel from)
LogEvent
getLastLogEvent(LogLevel from)
LogEvent
getLogEvent(int index)
LogTailResult
getLogEvents(LogLevel from, int offset, int limit)
List<LogEvent>
getLogs(LogLevel level)
Filter logs of a specific level.List<LogEvent>
getLogsFrom(LogLevel level)
Filter logs of a specific level.String
getName()
boolean
hasLogLevel(LogLevel from)
void
info(String msg)
void
info(String format, Object arg)
void
info(String format, Object... arguments)
void
info(String format, Object arg1, Object arg2)
void
info(String msg, Throwable t)
void
info(org.slf4j.Marker marker, String msg)
void
info(org.slf4j.Marker marker, String format, Object arg)
void
info(org.slf4j.Marker marker, String format, Object... arguments)
void
info(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
void
info(org.slf4j.Marker marker, String msg, Throwable t)
boolean
isDebugEnabled()
boolean
isDebugEnabled(org.slf4j.Marker marker)
boolean
isErrorEnabled()
boolean
isErrorEnabled(org.slf4j.Marker marker)
boolean
isInfoEnabled()
boolean
isInfoEnabled(org.slf4j.Marker marker)
boolean
isTraceEnabled()
boolean
isTraceEnabled(org.slf4j.Marker marker)
boolean
isWarnEnabled()
boolean
isWarnEnabled(org.slf4j.Marker marker)
void
log(org.slf4j.Logger targetLogger)
Copy the stored log into a passedLogger
.void
log(LogEvent logEvent)
void
trace(String msg)
void
trace(String format, Object arg)
void
trace(String format, Object... arguments)
void
trace(String format, Object arg1, Object arg2)
void
trace(String msg, Throwable t)
void
trace(org.slf4j.Marker marker, String msg)
void
trace(org.slf4j.Marker marker, String format, Object arg)
void
trace(org.slf4j.Marker marker, String format, Object... arguments)
void
trace(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
void
trace(org.slf4j.Marker marker, String msg, Throwable t)
void
warn(String msg)
void
warn(String format, Object arg)
void
warn(String format, Object... arguments)
void
warn(String format, Object arg1, Object arg2)
void
warn(String msg, Throwable t)
void
warn(org.slf4j.Marker marker, String msg)
void
warn(org.slf4j.Marker marker, String format, Object arg)
void
warn(org.slf4j.Marker marker, String format, Object... arguments)
void
warn(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
void
warn(org.slf4j.Marker marker, String msg, Throwable t)
-
Methods inherited from class java.util.concurrent.ConcurrentLinkedQueue
add, addAll, clear, contains, forEach, isEmpty, iterator, offer, peek, poll, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toString
-
Methods inherited from class java.util.AbstractQueue
element, remove
-
Methods inherited from class java.util.AbstractCollection
containsAll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
containsAll, equals, hashCode, parallelStream, stream, toArray
-
Methods inherited from interface org.slf4j.Logger
atDebug, atError, atInfo, atLevel, atTrace, atWarn, isEnabledForLevel, makeLoggingEventBuilder
-
Methods inherited from interface org.xwiki.logging.tail.LogTail
getFirstLogEvent, getLastLogEvent, getLogEvents, getLogEvents, size
-
-
-
-
Method Detail
-
log
public void log(org.slf4j.Logger targetLogger)
Copy the stored log into a passedLogger
.
-
addLogEvent
public LogEvent addLogEvent(LogLevel level, String format, Object[] arguments)
- Parameters:
level
- the log levelformat
- the log messagearguments
- the event arguments to insert in the message- Returns:
- the created
LogEvent
instance - Since:
- 4.1RC1
-
addLogEvent
public LogEvent addLogEvent(org.slf4j.Marker marker, LogLevel level, String format, Object[] arguments)
- Parameters:
marker
- the log markerlevel
- the log levelformat
- the log messagearguments
- the event arguments to insert in the message- Returns:
- the created
LogEvent
instance - Since:
- 4.3M1
-
addLogEvent
public LogEvent addLogEvent(LogLevel level, String format, Object[] arguments, Throwable throwable)
- Parameters:
level
- the log levelformat
- the log messagearguments
- the event arguments to insert in the messagethrowable
- the throwable associated to the event- Returns:
- the created
LogEvent
instance - Since:
- 4.1RC1
-
addLogEvent
public LogEvent addLogEvent(org.slf4j.Marker marker, LogLevel level, String format, Object[] arguments, Throwable throwable)
- Parameters:
marker
- the log markerlevel
- the log levelformat
- the log messagearguments
- the event arguments to insert in the messagethrowable
- the throwable associated to the event- Returns:
- the created
LogEvent
instance - Since:
- 4.3M1
-
log
public void log(LogEvent logEvent)
-
getLogEvent
public LogEvent getLogEvent(int index)
- Specified by:
getLogEvent
in interfaceLogTail
- Parameters:
index
- the index of the log event- Returns:
- the log event associated with the passed index or null if it does not exist
-
getFirstLogEvent
public LogEvent getFirstLogEvent(LogLevel from)
- Specified by:
getFirstLogEvent
in interfaceLogTail
- Parameters:
from
- the log level from which to select log events- Returns:
- the first log event with passed level or more
-
getLastLogEvent
public LogEvent getLastLogEvent(LogLevel from)
- Specified by:
getLastLogEvent
in interfaceLogTail
- Parameters:
from
- the log level from which to select log events- Returns:
- the last log event with passed level or more
-
getLogEvents
public LogTailResult getLogEvents(LogLevel from, int offset, int limit)
- Specified by:
getLogEvents
in interfaceLogTail
- Parameters:
from
- the log level from which to select log eventsoffset
- the offset where to start searching for the log eventslimit
- the maximum number of results to return- Returns:
- the log events with the passed level or more
-
hasLogLevel
public boolean hasLogLevel(LogLevel from)
- Specified by:
hasLogLevel
in interfaceLogTail
- Parameters:
from
- the log level from which to select log events- Returns:
- true if a log event with the passed log level or more was found
-
getLogs
public List<LogEvent> getLogs(LogLevel level)
Filter logs of a specific level.- Parameters:
level
- the level of the logs to return- Returns:
- the filtered logs
- Since:
- 4.1RC1
-
getLogsFrom
public List<LogEvent> getLogsFrom(LogLevel level)
Filter logs of a specific level.- Parameters:
level
- the level of the logs to return- Returns:
- the filtered logs
- Since:
- 4.2M1
-
containLogsFrom
public boolean containLogsFrom(LogLevel level)
Indicate if the list contains logs of a specific level.- Parameters:
level
- the level of the logs to return- Returns:
- true if log of provided level or less exist
- Since:
- 6.0M1
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.slf4j.Logger
-
isTraceEnabled
public boolean isTraceEnabled()
- Specified by:
isTraceEnabled
in interfaceorg.slf4j.Logger
-
trace
public void trace(String msg)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(String format, Object arg)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(String format, Object arg1, Object arg2)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(String format, Object... arguments)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
isTraceEnabled
public boolean isTraceEnabled(org.slf4j.Marker marker)
- Specified by:
isTraceEnabled
in interfaceorg.slf4j.Logger
-
trace
public void trace(org.slf4j.Marker marker, String msg)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(org.slf4j.Marker marker, String format, Object arg)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(org.slf4j.Marker marker, String format, Object... arguments)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
trace
public void trace(org.slf4j.Marker marker, String msg, Throwable t)
- Specified by:
trace
in interfaceorg.slf4j.Logger
-
isDebugEnabled
public boolean isDebugEnabled()
- Specified by:
isDebugEnabled
in interfaceorg.slf4j.Logger
-
debug
public void debug(String msg)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(String format, Object arg)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(String format, Object arg1, Object arg2)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(String format, Object... arguments)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
isDebugEnabled
public boolean isDebugEnabled(org.slf4j.Marker marker)
- Specified by:
isDebugEnabled
in interfaceorg.slf4j.Logger
-
debug
public void debug(org.slf4j.Marker marker, String msg)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(org.slf4j.Marker marker, String format, Object arg)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(org.slf4j.Marker marker, String format, Object... arguments)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
debug
public void debug(org.slf4j.Marker marker, String msg, Throwable t)
- Specified by:
debug
in interfaceorg.slf4j.Logger
-
isInfoEnabled
public boolean isInfoEnabled()
- Specified by:
isInfoEnabled
in interfaceorg.slf4j.Logger
-
info
public void info(String msg)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(String format, Object arg1, Object arg2)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(String format, Object... arguments)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
isInfoEnabled
public boolean isInfoEnabled(org.slf4j.Marker marker)
- Specified by:
isInfoEnabled
in interfaceorg.slf4j.Logger
-
info
public void info(org.slf4j.Marker marker, String msg)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(org.slf4j.Marker marker, String format, Object arg)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(org.slf4j.Marker marker, String format, Object... arguments)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
info
public void info(org.slf4j.Marker marker, String msg, Throwable t)
- Specified by:
info
in interfaceorg.slf4j.Logger
-
isWarnEnabled
public boolean isWarnEnabled()
- Specified by:
isWarnEnabled
in interfaceorg.slf4j.Logger
-
warn
public void warn(String msg)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(String format, Object arg1, Object arg2)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(String format, Object... arguments)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
isWarnEnabled
public boolean isWarnEnabled(org.slf4j.Marker marker)
- Specified by:
isWarnEnabled
in interfaceorg.slf4j.Logger
-
warn
public void warn(org.slf4j.Marker marker, String msg)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(org.slf4j.Marker marker, String format, Object arg)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(org.slf4j.Marker marker, String format, Object... arguments)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
warn
public void warn(org.slf4j.Marker marker, String msg, Throwable t)
- Specified by:
warn
in interfaceorg.slf4j.Logger
-
isErrorEnabled
public boolean isErrorEnabled()
- Specified by:
isErrorEnabled
in interfaceorg.slf4j.Logger
-
error
public void error(String msg)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(String format, Object arg)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(String format, Object arg1, Object arg2)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(String format, Object... arguments)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
isErrorEnabled
public boolean isErrorEnabled(org.slf4j.Marker marker)
- Specified by:
isErrorEnabled
in interfaceorg.slf4j.Logger
-
error
public void error(org.slf4j.Marker marker, String msg)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(org.slf4j.Marker marker, String format, Object arg)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(org.slf4j.Marker marker, String format, Object arg1, Object arg2)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(org.slf4j.Marker marker, String format, Object... arguments)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
error
public void error(org.slf4j.Marker marker, String msg, Throwable t)
- Specified by:
error
in interfaceorg.slf4j.Logger
-
flush
public void flush()
Description copied from interface:LoggerTail
Force writing and wait for any writing to be finished.- Specified by:
flush
in interfaceLoggerTail
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-