]> source.dussan.org Git - gitblit.git/commitdiff
Do not serialize Logger ticket/114 14/114/1
authorJames Moger <james.moger@gitblit.com>
Fri, 27 Jun 2014 18:25:42 +0000 (14:25 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 27 Jun 2014 18:25:42 +0000 (14:25 -0400)
src/main/java/com/gitblit/wicket/panels/BasePanel.java
src/main/java/com/gitblit/wicket/panels/HistoryPanel.java

index e8f8f6f2a265787cb83c9a1241c023dddbe946fa..73f8e4717c340532a073ebea45a4767ea5a389b0 100644 (file)
@@ -22,6 +22,8 @@ import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;\r
 import org.apache.wicket.markup.html.panel.Panel;\r
 import org.apache.wicket.model.Model;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 import com.gitblit.Constants;\r
 import com.gitblit.Keys;\r
@@ -36,6 +38,8 @@ public abstract class BasePanel extends Panel {
 \r
        private transient TimeUtils timeUtils;\r
 \r
+       private transient Logger logger;\r
+\r
        public BasePanel(String wicketId) {\r
                super(wicketId);\r
        }\r
@@ -44,6 +48,13 @@ public abstract class BasePanel extends Panel {
                return GitBlitWebApp.get();\r
        }\r
 \r
+       protected Logger logger() {\r
+               if (logger == null) {\r
+                       logger = LoggerFactory.getLogger(getClass());\r
+               }\r
+               return logger;\r
+       }\r
+\r
        protected String getContextUrl() {\r
                return getRequest().getRelativePathPrefixToContextRoot();\r
        }\r
index 21f38388ea94d30298fe3c123d97c7e79616808e..e1706a09d3db834ba91b4b9d531a44bfef8e3e99 100644 (file)
@@ -38,8 +38,6 @@ import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.revwalk.RevCommit;\r
 import org.eclipse.jgit.treewalk.TreeWalk;\r
 import org.eclipse.jgit.treewalk.filter.PathFilterGroup;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
 \r
 import com.gitblit.Constants;\r
 import com.gitblit.Keys;\r
@@ -63,8 +61,6 @@ public class HistoryPanel extends BasePanel {
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       private final Logger log = LoggerFactory.getLogger(getClass());\r
-\r
        private boolean hasMore;\r
 \r
        public HistoryPanel(String wicketId, final String repositoryName, final String objectId,\r
@@ -84,7 +80,7 @@ public class HistoryPanel extends BasePanel {
                        // commit missing\r
                        String msg = MessageFormat.format("Failed to find history of **{0}** *{1}*",\r
                                        path, objectId);\r
-                       log.error(msg + " " + repositoryName);\r
+                       logger().error(msg + " " + repositoryName);\r
                        add(new Label("commitHeader", MarkdownUtils.transformMarkdown(msg)).setEscapeModelStrings(false));\r
                        add(new Label("breadcrumbs"));\r
                } else {\r