diff options
author | James Moger <james.moger@gitblit.com> | 2013-12-30 13:51:53 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-12-30 13:51:53 -0500 |
commit | e92cef5abcbf6989e8ce58093b34b3ed909da4b8 (patch) | |
tree | 6593b67b55c833661a027db616d324bfe2b27a73 /src/main | |
parent | f569f887f14db1dd41c871d43a7c1abd5dd36074 (diff) | |
download | gitblit-e92cef5abcbf6989e8ce58093b34b3ed909da4b8.tar.gz gitblit-e92cef5abcbf6989e8ce58093b34b3ed909da4b8.zip |
Do not serialize the Logger instance
Change-Id: Icbef95e95d05fa8d7dbdc750241252d291083820
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/BasePage.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java index 647a9388..ec84df65 100644 --- a/src/main/java/com/gitblit/wicket/pages/BasePage.java +++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java @@ -65,22 +65,27 @@ import com.gitblit.wicket.WicketUtils; public abstract class BasePage extends SessionPage {
- private final Logger logger;
+ private transient Logger logger;
private transient TimeUtils timeUtils;
public BasePage() {
super();
- logger = LoggerFactory.getLogger(getClass());
customizeHeader();
}
public BasePage(PageParameters params) {
super(params);
- logger = LoggerFactory.getLogger(getClass());
customizeHeader();
}
+ protected Logger logger() {
+ if (logger == null) {
+ logger = LoggerFactory.getLogger(getClass());
+ }
+ return logger;
+ }
+
private void customizeHeader() {
if (app().settings().getBoolean(Keys.web.useResponsiveLayout, true)) {
add(CSSPackageResource.getHeaderContribution("bootstrap/css/bootstrap-responsive.css"));
@@ -171,7 +176,7 @@ public abstract class BasePage extends SessionPage { case NONE:
break;
default:
- logger.warn(getClass().getSimpleName() + ": unhandled LastModified type " + cacheControl.value());
+ logger().warn(getClass().getSimpleName() + ": unhandled LastModified type " + cacheControl.value());
break;
}
}
@@ -411,7 +416,7 @@ public abstract class BasePage extends SessionPage { }
public void warn(String message, Throwable t) {
- logger.warn(message, t);
+ logger().warn(message, t);
}
public void error(String message, boolean redirect) {
@@ -428,9 +433,9 @@ public abstract class BasePage extends SessionPage { public void error(String message, Throwable t, Class<? extends Page> toPage, PageParameters params) {
if (t == null) {
- logger.error(message + " for " + GitBlitWebSession.get().getUsername());
+ logger().error(message + " for " + GitBlitWebSession.get().getUsername());
} else {
- logger.error(message + " for " + GitBlitWebSession.get().getUsername(), t);
+ logger().error(message + " for " + GitBlitWebSession.get().getUsername(), t);
}
if (toPage != null) {
GitBlitWebSession.get().cacheErrorMessage(message);
@@ -443,7 +448,7 @@ public abstract class BasePage extends SessionPage { }
public void authenticationError(String message) {
- logger.error(getRequest().getURL() + " for " + GitBlitWebSession.get().getUsername());
+ logger().error(getRequest().getURL() + " for " + GitBlitWebSession.get().getUsername());
if (!GitBlitWebSession.get().isLoggedIn()) {
// cache the request if we have not authenticated.
// the request will continue after authentication.
|