Log web layer exceptions in server log file

This commit is contained in:
Konstantin Krivopustov 2009-02-12 08:26:59 +00:00
parent c161aa5fb5
commit b6e93d3e66

View File

@ -21,13 +21,20 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class AppLog
{
private LinkedList<LogItem> items = new LinkedList<LogItem>();
private int capacity = 100;
private Log log = LogFactory.getLog(AppLog.class);
public void log(LogItem item) {
log.debug(item.getLevel() + ": " + item.getMessage(), item.getThrowable());
if (items.size() >= capacity) {
items.removeLast();
}