From f0e7b0373cdafa8d4a5dba33747e68d3f0d505c5 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 27 Aug 2015 21:17:48 +0200 Subject: [PATCH] =?utf8?q?Added=20logger=20to=20tag=20+=20used=20"this"=20?= =?utf8?q?Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../beans/PizzaServiceBean.java | 4 +-- .../tags/basket/MiniBasketTag.java | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java index 7ff4e8ba..fbbb338f 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java @@ -81,8 +81,8 @@ public class PizzaServiceBean implements PizzaBean { */ { // Get new application instance - LOG = LogManager.getLogger(this); - LOG.debug("INITIALIZER!"); + this.LOG = LogManager.getLogger(this); + this.LOG.debug("INITIALIZER!"); this.app = new PizzaServiceApplication(); } diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java index 1ec420a3..b0d84b9e 100644 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java @@ -21,6 +21,8 @@ import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.BodyTagSupport; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.pizzaapplication.beans.basket.BasketBean; @@ -41,6 +43,18 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { */ private BasketBean basket; + /** + * Logger instance + */ + private final Logger LOG; + + /** + * Initializer + */ + { + this.LOG = LogManager.getLogger(this); + } + /** * Outputs a div container with last added item + a link to the basket * web page. @@ -50,6 +64,9 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { */ @Override public int doStartTag () throws JspException { + // Trace message + this.LOG.trace("CALLED!"); + // Init output StringBuilder out = new StringBuilder("
\n"); @@ -86,6 +103,9 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { throw new JspException(ex); } + // Trace message + this.LOG.trace("Returning " + SKIP_BODY + " ... - EXIT!"); + // Don't process any body return SKIP_BODY; } @@ -95,6 +115,10 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { */ @Override public BasketBean getBasket () { + // Trace message + this.LOG.trace("basket=" + this.basket + " - EXIT!"); + + // Return it return this.basket; } @@ -103,6 +127,10 @@ public class MiniBasketTag extends BodyTagSupport implements BasketTag { */ @Override public void setBasket (final BasketBean basket) { + // Trace message + this.LOG.trace("basked=" + basket + " - CALLED!"); + + // Set it here this.basket = basket; } } -- 2.39.5