001
014
015 package com.liferay.portal.kernel.log;
016
017
020 public class LogWrapper implements Log {
021
022 public LogWrapper(Log log) {
023 _log = log;
024 }
025
026 @Override
027 public void debug(Object msg) {
028 try {
029 _log.debug(msg);
030 }
031 catch (Exception e) {
032 printMsg(msg);
033 }
034 }
035
036 @Override
037 public void debug(Object msg, Throwable t) {
038 try {
039 _log.debug(msg, t);
040 }
041 catch (Exception e) {
042 printMsg(msg);
043 }
044 }
045
046 @Override
047 public void debug(Throwable t) {
048 try {
049 _log.debug(t);
050 }
051 catch (Exception e) {
052 printMsg(t.getMessage());
053 }
054 }
055
056 @Override
057 public void error(Object msg) {
058 try {
059 _log.error(msg);
060 }
061 catch (Exception e) {
062 printMsg(msg);
063 }
064 }
065
066 @Override
067 public void error(Object msg, Throwable t) {
068 try {
069 _log.error(msg, t);
070 }
071 catch (Exception e) {
072 printMsg(msg);
073 }
074 }
075
076 @Override
077 public void error(Throwable t) {
078 try {
079 _log.error(t);
080 }
081 catch (Exception e) {
082 printMsg(t.getMessage());
083 }
084 }
085
086 @Override
087 public void fatal(Object msg) {
088 try {
089 _log.fatal(msg);
090 }
091 catch (Exception e) {
092 printMsg(msg);
093 }
094 }
095
096 @Override
097 public void fatal(Object msg, Throwable t) {
098 try {
099 _log.fatal(msg, t);
100 }
101 catch (Exception e) {
102 printMsg(msg);
103 }
104 }
105
106 @Override
107 public void fatal(Throwable t) {
108 try {
109 _log.fatal(t);
110 }
111 catch (Exception e) {
112 printMsg(t.getMessage());
113 }
114 }
115
116 @Override
117 public void info(Object msg) {
118 try {
119 _log.info(msg);
120 }
121 catch (Exception e) {
122 printMsg(msg);
123 }
124 }
125
126 @Override
127 public void info(Object msg, Throwable t) {
128 try {
129 _log.info(msg, t);
130 }
131 catch (Exception e) {
132 printMsg(msg);
133 }
134 }
135
136 @Override
137 public void info(Throwable t) {
138 try {
139 _log.info(t);
140 }
141 catch (Exception e) {
142 printMsg(t.getMessage());
143 }
144 }
145
146 @Override
147 public boolean isDebugEnabled() {
148 return _log.isDebugEnabled();
149 }
150
151 @Override
152 public boolean isErrorEnabled() {
153 return _log.isErrorEnabled();
154 }
155
156 @Override
157 public boolean isFatalEnabled() {
158 return _log.isFatalEnabled();
159 }
160
161 @Override
162 public boolean isInfoEnabled() {
163 return _log.isInfoEnabled();
164 }
165
166 @Override
167 public boolean isTraceEnabled() {
168 return _log.isTraceEnabled();
169 }
170
171 @Override
172 public boolean isWarnEnabled() {
173 return _log.isWarnEnabled();
174 }
175
176 public void setLog(Log log) {
177 _log = log;
178 }
179
180 @Override
181 public void trace(Object msg) {
182 try {
183 _log.trace(msg);
184 }
185 catch (Exception e) {
186 printMsg(msg);
187 }
188 }
189
190 @Override
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 @Override
201 public void trace(Throwable t) {
202 try {
203 _log.trace(t);
204 }
205 catch (Exception e) {
206 printMsg(t.getMessage());
207 }
208 }
209
210 @Override
211 public void warn(Object msg) {
212 try {
213 _log.warn(msg);
214 }
215 catch (Exception e) {
216 printMsg(msg);
217 }
218 }
219
220 @Override
221 public void warn(Object msg, Throwable t) {
222 try {
223 _log.warn(msg, t);
224 }
225 catch (Exception e) {
226 printMsg(msg);
227 }
228 }
229
230 @Override
231 public void warn(Throwable t) {
232 try {
233 _log.warn(t);
234 }
235 catch (Exception e) {
236 printMsg(t.getMessage());
237 }
238 }
239
240 protected void printMsg(Object msg) {
241 System.err.println(msg);
242 }
243
244 private Log _log;
245
246 }