From: James Moger Date: Fri, 27 Jun 2014 18:25:42 +0000 (-0400) Subject: Do not serialize Logger X-Git-Tag: v1.6.1~75^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fheads%2Fticket%2F114;p=gitblit.git Do not serialize Logger --- diff --git a/src/main/java/com/gitblit/wicket/panels/BasePanel.java b/src/main/java/com/gitblit/wicket/panels/BasePanel.java index e8f8f6f2..73f8e471 100644 --- a/src/main/java/com/gitblit/wicket/panels/BasePanel.java +++ b/src/main/java/com/gitblit/wicket/panels/BasePanel.java @@ -22,6 +22,8 @@ import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.Model; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.gitblit.Constants; import com.gitblit.Keys; @@ -36,6 +38,8 @@ public abstract class BasePanel extends Panel { private transient TimeUtils timeUtils; + private transient Logger logger; + public BasePanel(String wicketId) { super(wicketId); } @@ -44,6 +48,13 @@ public abstract class BasePanel extends Panel { return GitBlitWebApp.get(); } + protected Logger logger() { + if (logger == null) { + logger = LoggerFactory.getLogger(getClass()); + } + return logger; + } + protected String getContextUrl() { return getRequest().getRelativePathPrefixToContextRoot(); } diff --git a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java index 21f38388..e1706a09 100644 --- a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java @@ -38,8 +38,6 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.filter.PathFilterGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.gitblit.Constants; import com.gitblit.Keys; @@ -63,8 +61,6 @@ public class HistoryPanel extends BasePanel { private static final long serialVersionUID = 1L; - private final Logger log = LoggerFactory.getLogger(getClass()); - private boolean hasMore; public HistoryPanel(String wicketId, final String repositoryName, final String objectId, @@ -84,7 +80,7 @@ public class HistoryPanel extends BasePanel { // commit missing String msg = MessageFormat.format("Failed to find history of **{0}** *{1}*", path, objectId); - log.error(msg + " " + repositoryName); + logger().error(msg + " " + repositoryName); add(new Label("commitHeader", MarkdownUtils.transformMarkdown(msg)).setEscapeModelStrings(false)); add(new Label("breadcrumbs")); } else {