*/
public final class LogServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
MemoryHandler logHandler = (MemoryHandler) getServletContext().getAttribute(InitListener.LOG_HANDLER);
response.setContentType("text/plain");
response.setCharacterEncoding(Charsets.UTF_8.name());
Writer out = response.getWriter();
Iterable<String> lines = logHandler.getLogLines();
synchronized (lines) {
for (String line : lines) {
out.write(line); // Already has newline
}
}