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 e8f8f6f..73f8e47 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.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 @@
private transient TimeUtils timeUtils;
+ private transient Logger logger;
+
public BasePanel(String wicketId) {
super(wicketId);
}
@@ -44,6 +48,13 @@
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 21f3838..e1706a0 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.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 @@
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 @@
// 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 {