Skip to content

Commit

Permalink
Fix #679 where an NPE is thrown if the logback config doesn't have
Browse files Browse the repository at this point in the history
a cyclic buffered appender to keep track of the last x log lines.
Now it will throw a BadRequest exception with a useful message.

Signed-off-by: Chris Larsen <[email protected]>
  • Loading branch information
manolama committed Feb 1, 2016
1 parent 62cc3b7 commit d7fb09e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tsd/LogsRpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public LogIterator() {
final Logger root =
(Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
logbuf = (CyclicBufferAppender<ILoggingEvent>) root.getAppender("CYCLIC");
if (logbuf == null) {
throw new BadRequestException(
"No CyclicBufferAppender found. Please configure logback "
+ "to store the latest log entries.");
}
}

public Iterator<String> iterator() {
Expand Down

0 comments on commit d7fb09e

Please sign in to comment.