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