1
19
20 package com.liferay.portal.kernel.log;
21
22
28 public class LogWrapper implements Log {
29
30 public LogWrapper(Log log) {
31 _log = log;
32 }
33
34 public void setLog(Log log) {
35 _log = log;
36 }
37
38 public void debug(Object msg) {
39 try {
40 _log.debug(msg);
41 }
42 catch (Exception e) {
43 printMsg(msg);
44 }
45 }
46
47 public void debug(Throwable t) {
48 try {
49 _log.debug(t);
50 }
51 catch (Exception e) {
52 printMsg(t.getMessage());
53 }
54 }
55
56 public void debug(Object msg, Throwable t) {
57 try {
58 _log.debug(msg, t);
59 }
60 catch (Exception e) {
61 printMsg(msg);
62 }
63 }
64
65 public void error(Object msg) {
66 try {
67 _log.error(msg);
68 }
69 catch (Exception e) {
70 printMsg(msg);
71 }
72 }
73
74 public void error(Throwable t) {
75 try {
76 _log.error(t);
77 }
78 catch (Exception e) {
79 printMsg(t.getMessage());
80 }
81 }
82
83 public void error(Object msg, Throwable t) {
84 try {
85 _log.error(msg, t);
86 }
87 catch (Exception e) {
88 printMsg(msg);
89 }
90 }
91
92 public void fatal(Object msg) {
93 try {
94 _log.fatal(msg);
95 }
96 catch (Exception e) {
97 printMsg(msg);
98 }
99 }
100
101 public void fatal(Throwable t) {
102 try {
103 _log.fatal(t);
104 }
105 catch (Exception e) {
106 printMsg(t.getMessage());
107 }
108 }
109
110 public void fatal(Object msg, Throwable t) {
111 try {
112 _log.fatal(msg, t);
113 }
114 catch (Exception e) {
115 printMsg(msg);
116 }
117 }
118
119 public void info(Object msg) {
120 try {
121 _log.info(msg);
122 }
123 catch (Exception e) {
124 printMsg(msg);
125 }
126 }
127
128 public void info(Throwable t) {
129 try {
130 _log.info(t);
131 }
132 catch (Exception e) {
133 printMsg(t.getMessage());
134 }
135 }
136
137 public void info(Object msg, Throwable t) {
138 try {
139 _log.info(msg, t);
140 }
141 catch (Exception e) {
142 printMsg(msg);
143 }
144 }
145
146 public boolean isDebugEnabled() {
147 return _log.isDebugEnabled();
148 }
149
150 public boolean isErrorEnabled() {
151 return _log.isErrorEnabled();
152 }
153
154 public boolean isFatalEnabled() {
155 return _log.isFatalEnabled();
156 }
157
158 public boolean isInfoEnabled() {
159 return _log.isInfoEnabled();
160 }
161
162 public boolean isTraceEnabled() {
163 return _log.isTraceEnabled();
164 }
165
166 public boolean isWarnEnabled() {
167 return _log.isWarnEnabled();
168 }
169
170 public void trace(Object msg) {
171 try {
172 _log.trace(msg);
173 }
174 catch (Exception e) {
175 printMsg(msg);
176 }
177 }
178
179 public void trace(Throwable t) {
180 try {
181 _log.trace(t);
182 }
183 catch (Exception e) {
184 printMsg(t.getMessage());
185 }
186 }
187
188 public void trace(Object msg, Throwable t) {
189 try {
190 _log.trace(msg, t);
191 }
192 catch (Exception e) {
193 printMsg(msg);
194 }
195 }
196
197 public void warn(Object msg) {
198 try {
199 _log.warn(msg);
200 }
201 catch (Exception e) {
202 printMsg(msg);
203 }
204 }
205
206 public void warn(Throwable t) {
207 try {
208 _log.warn(t);
209 }
210 catch (Exception e) {
211 printMsg(t.getMessage());
212 }
213 }
214
215 public void warn(Object msg, Throwable t) {
216 try {
217 _log.warn(msg, t);
218 }
219 catch (Exception e) {
220 printMsg(msg);
221 }
222 }
223
224 protected void printMsg(Object msg) {
225 System.err.println(msg);
226 }
227
228 private Log _log;
229
230 }