1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.taglib;
18
19 import javax.servlet.jsp.JspException;
20 import javax.servlet.jsp.tagext.Tag;
21
22 import org.apache.logging.log4j.Level;
23
24
25
26
27
28
29 public class ExitTag extends LoggerAwareTagSupport {
30 private static final long serialVersionUID = 1L;
31
32 private static final String FQCN = ExitTag.class.getName();
33
34 private transient Object result;
35
36 @Override
37 protected void init() {
38 super.init();
39 this.result = null;
40 }
41
42 public void setResult(final Object result) {
43 this.result = result;
44 }
45
46 @Override
47 public int doEndTag() throws JspException {
48 final Log4jTaglibLogger logger = this.getLogger();
49
50 if (TagUtils.isEnabled(logger, Level.TRACE, null)) {
51 if (this.result == null) {
52 logger.exit(FQCN, null);
53 } else {
54 logger.exit(FQCN, this.result);
55 }
56 }
57
58 return Tag.EVAL_PAGE;
59 }
60 }