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