Lines 34-39
Link Here
|
34 |
|
34 |
|
35 |
private String category; |
35 |
private String category; |
36 |
private String message; |
36 |
private String message; |
|
|
37 |
private Throwable t; |
37 |
|
38 |
|
38 |
|
39 |
|
39 |
public void setCategory(String category) { |
40 |
public void setCategory(String category) { |
Lines 44-49
Link Here
|
44 |
this.message = message; |
45 |
this.message = message; |
45 |
} |
46 |
} |
46 |
|
47 |
|
|
|
48 |
public void setException(Throwable t) { |
49 |
this.t = t; |
50 |
} |
51 |
|
47 |
// Tag interface |
52 |
// Tag interface |
48 |
//------------------------------------------------------------------------- |
53 |
//------------------------------------------------------------------------- |
49 |
public int doStartTag() throws JspException { |
54 |
public int doStartTag() throws JspException { |
Lines 51-57
Link Here
|
51 |
Log logCategory = getLoggingCategory(); |
56 |
Log logCategory = getLoggingCategory(); |
52 |
if ( isEnabled( logCategory ) ) { |
57 |
if ( isEnabled( logCategory ) ) { |
53 |
// Log now as doAfterBody() may not be called for an empty tag |
58 |
// Log now as doAfterBody() may not be called for an empty tag |
54 |
log( logCategory, message ); |
59 |
if ( t == null ) { |
|
|
60 |
log( logCategory, message ); |
61 |
} else { |
62 |
log( logCategory, message, t ); |
63 |
} |
55 |
} |
64 |
} |
56 |
return SKIP_BODY; |
65 |
return SKIP_BODY; |
57 |
} |
66 |
} |
Lines 62-68
Link Here
|
62 |
if (message == null) { |
71 |
if (message == null) { |
63 |
Log logCategory = getLoggingCategory(); |
72 |
Log logCategory = getLoggingCategory(); |
64 |
if ( isEnabled( logCategory ) ) { |
73 |
if ( isEnabled( logCategory ) ) { |
65 |
log( logCategory, getBodyContent().getString().trim() ); |
74 |
if ( t == null ) { |
|
|
75 |
log( logCategory, getBodyContent().getString().trim() ); |
76 |
} else { |
77 |
log( logCategory, getBodyContent().getString().trim(), t ); |
78 |
} |
66 |
} |
79 |
} |
67 |
} |
80 |
} |
68 |
return SKIP_BODY; |
81 |
return SKIP_BODY; |
Lines 72-77
Link Here
|
72 |
//------------------------------------------------------------------------- |
85 |
//------------------------------------------------------------------------- |
73 |
protected abstract boolean isEnabled(Log logCategory); |
86 |
protected abstract boolean isEnabled(Log logCategory); |
74 |
protected abstract void log(Log logCategory, String message); |
87 |
protected abstract void log(Log logCategory, String message); |
|
|
88 |
protected abstract void log(Log logCategory, String message, Throwable t); |
75 |
|
89 |
|
76 |
protected Log getLoggingCategory() { |
90 |
protected Log getLoggingCategory() { |
77 |
if ( category == null ) { |
91 |
if ( category == null ) { |