KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jcorporate > expresso > core > logging > LogHandler


1 /* ====================================================================
2  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
3  *
4  * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * 3. The end-user documentation included with the redistribution,
19  * if any, must include the following acknowledgment:
20  * "This product includes software developed by Jcorporate Ltd.
21  * (http://www.jcorporate.com/)."
22  * Alternately, this acknowledgment may appear in the software itself,
23  * if and wherever such third-party acknowledgments normally appear.
24  *
25  * 4. "Jcorporate" and product names such as "Expresso" must
26  * not be used to endorse or promote products derived from this
27  * software without prior written permission. For written permission,
28  * please contact info@jcorporate.com.
29  *
30  * 5. Products derived from this software may not be called "Expresso",
31  * or other Jcorporate product names; nor may "Expresso" or other
32  * Jcorporate product names appear in their name, without prior
33  * written permission of Jcorporate Ltd.
34  *
35  * 6. No product derived from this software may compete in the same
36  * market space, i.e. framework, without prior written permission
37  * of Jcorporate Ltd. For written permission, please contact
38  * partners@jcorporate.com.
39  *
40  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
43  * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
44  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
46  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
47  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This software consists of voluntary contributions made by many
55  * individuals on behalf of the Jcorporate Ltd. Contributions back
56  * to the project(s) are encouraged when you make modifications.
57  * Please send them to support@jcorporate.com. For more information
58  * on Jcorporate Ltd. and its products, please see
59  * <http://www.jcorporate.com/>.
60  *
61  * Portions of this software are based upon other open source
62  * products and are subject to their respective licenses.
63  */

64
65 /*
66  * LogHandler.java
67  *
68  * Copyright 1999, 2000, 2001 Jcorporate Ltd.
69  */

70 package com.jcorporate.expresso.core.logging;
71
72 import com.jcorporate.expresso.core.db.DBException;
73 import com.jcorporate.expresso.core.registry.ExpressoThread;
74 import com.jcorporate.expresso.services.dbobj.LogEntry;
75 import org.apache.log4j.Logger;
76
77 import java.io.ByteArrayOutputStream JavaDoc;
78 import java.io.PrintStream JavaDoc;
79 import java.util.Vector JavaDoc;
80
81
82 /**
83  * The LogHandler is an asynchronous version of logging - it accepts
84  * requests to log, then logs them "eventually" in a separate thread
85  *
86  * @author Michael Nash
87  * @deprecated As of Expresso 5.6 This has not been used since
88  * Log4j was integrated with Expresso.
89  */

90 public class LogHandler
91         extends ExpressoThread {
92     private static Vector JavaDoc queue = new Vector JavaDoc(3);
93     private static boolean trace = false;
94     private static LogHandler myInstance = null;
95     private static int maxLevel = 9;
96     private static boolean daemonMode = false;
97     private static Logger log = Logger.getLogger(LogHandler.class);
98
99     /**
100      * Log Handler shuts down it's background thread when it's been
101      * idle for a while
102      */

103     private static int idleTimes = 0;
104     private static int maxIdleTimes = 10;
105
106     /**
107      * Don't write more than a certain number of log entries, it slows
108      * the system down too much
109      */

110     private static int maxWrites = 5;
111
112     /**
113      * How long to sleep between checking the queue
114      */

115     private int sleepTime = 30;
116     private static String JavaDoc thisClass = LogHandler.class.getName();
117
118     /**
119      * Constructor
120      */

121     public LogHandler() {
122
123         /* String sleepTimeString = StringUtil.notNull(ConfigManager.getProperty(
124
125             "loghandler.sleeptime"));
126
127         if (!sleepTimeString.equals("")) {
128
129             sleepTime = new Integer(sleepTimeString).intValue();
130
131         } */

132     } /* LogHandler() */
133
134     /**
135      * @param le
136      */

137     public synchronized void addToQueue(LogEntry le) {
138         queue.addElement(le);
139     } /* addToQueue(LogEntry) */
140
141     /**
142      * Takes a premade LogEntry and sends it to the logging queue. Used by
143      * the DBAppender.class
144      *
145      * @param le
146      */

147     public static synchronized void staticAddToQueue(LogEntry le) {
148         startUp();
149
150         if (myInstance != null) {
151             queue.addElement(le);
152         }
153     } /* staticAddToQueue(LogEntry) */
154
155
156     /**
157      * Actually check the log queue and save the entries
158      */

159     private synchronized void checkQueue()
160             throws LogException {
161         String JavaDoc myName = (thisClass + "checkQueue()");
162
163         if (queue.size() == 0) {
164             idleTimes++;
165
166             if (trace) {
167                 System.err.println(myName + ":Queue empty. Idle " + idleTimes +
168                         " times");
169             }
170
171             return;
172         }
173         if (trace) {
174             System.err.println(myName + ":Checking queue. " + queue.size() +
175                     " entries");
176         }
177         try {
178             LogEntry oneLogEntry = null;
179             int writeCount = 0;
180
181             while (queue.size() > 0) {
182                 oneLogEntry = (LogEntry) queue.firstElement();
183                 queue.removeElementAt(0);
184                 oneLogEntry.add();
185                 writeCount++;
186
187                 if (writeCount > maxWrites) {
188                     break;
189                 }
190             } /* for each queue entry */
191
192         } catch (Exception JavaDoc de) {
193             de.printStackTrace(System.err);
194             throw new LogException(myName +
195                     ":Database error storing log queue", de);
196         }
197     } /* checkQueue() */
198
199
200     /**
201      * Translate a color spelt out in english in to a one-char encoding
202      *
203      * @param color
204      * @return
205      */

206     private static String JavaDoc encode(String JavaDoc color) {
207         if (color.equalsIgnoreCase("RED")) {
208             return ("R");
209         } else if (color.equalsIgnoreCase("GREEN")) {
210             return ("G");
211         } else if (color.equalsIgnoreCase("BLUE")) {
212             return ("B");
213         } else if (color.equalsIgnoreCase("YELLOW")) {
214             return ("Y");
215         } else {
216             return ("");
217         }
218     } /* encode(String) */
219
220     /**
221      * If for any reason the app exits, and gc is getting called
222      * we need to flush what we've got and then bail.
223      */

224     public void finalize() {
225         try {
226             flush();
227         } catch (LogException e) {
228         }
229     } /* finalize() */
230
231     /**
232      * @throws LogException
233      */

234     public static void flush()
235             throws LogException {
236         startUp();
237         myInstance.checkQueue();
238     } /* flush() */
239
240
241     /**
242      * Log a new message at the given level, if we log at or above this level
243      *
244      * @param newLevel Log level
245      * @param msg Message to log
246      */

247     public static void log(int newLevel, String JavaDoc msg) {
248         String JavaDoc myName = (thisClass + "log(int, String)");
249
250         if (newLevel <= maxLevel) {
251             if (trace) {
252                 System.err.println(msg);
253             }
254
255             startUp();
256
257             try {
258                 LogEntry myLog = new LogEntry();
259                 myLog.setField("MessageText", msg);
260                 myLog.setField("MessageLevel", "" + newLevel);
261                 myLog.setTimeStamp();
262                 myInstance.addToQueue(myLog);
263             } catch (DBException de) {
264                 System.err.println(myName + ":Unable to log '" + msg + "'");
265                 de.printStackTrace(System.err);
266             }
267         } /* if level is logged */
268
269     } /* log(int, String) */
270
271
272     /**
273      * Log the given message at the given level, recording the originating
274      * object
275      *
276      * @param newLevel Logging level of this message
277      * @param objectName Calling object
278      * @param msg Message to log
279      */

280     public static void log(int newLevel, String JavaDoc objectName, String JavaDoc msg)
281             throws LogException {
282         String JavaDoc myName = (thisClass + "log(int, String, String)");
283
284         if (newLevel <= maxLevel) {
285             if (trace) {
286                 System.err.println(objectName + ":" + msg);
287             }
288
289             startUp();
290
291             try {
292                 LogEntry myLog = new LogEntry();
293                 myLog.setField("ObjectName", objectName);
294                 myLog.setField("MessageText", msg);
295                 myLog.setField("MessageLevel", "" + newLevel);
296                 myLog.setTimeStamp();
297                 myInstance.addToQueue(myLog);
298             } catch (DBException de) {
299                 throw new LogException(myName + ":" + de.getMessage());
300             }
301         } /* if this level is logged */
302
303     } /* log(int, String, String) */
304
305
306     /**
307      * Log a message from a particular object with a color at the given
308      * level
309      *
310      * @param newLevel Message level to log
311      * @param objectName Calling object
312      * @param msg Message to log
313      * @param color Color to log the message with
314      */

315     public static void log(int newLevel, String JavaDoc objectName, String JavaDoc msg,
316                            String JavaDoc color) {
317         String JavaDoc myName = (thisClass + "log(int, String, String, " +
318                 "String)");
319
320         if (newLevel <= maxLevel) {
321             if (trace) {
322                 System.err.println(objectName + ":" + msg);
323             }
324
325             startUp();
326
327             try {
328                 LogEntry myLog = new LogEntry();
329                 myLog.setField("ObjectName", objectName);
330                 myLog.setField("MessageText", msg);
331                 myLog.setField("MessageColor", encode(color));
332                 myLog.setField("MessageLevel", "" + newLevel);
333                 myLog.setTimeStamp();
334                 myInstance.addToQueue(myLog);
335             } catch (DBException de) {
336                 System.err.println(myName + ":Unable to log '" + msg + "'");
337                 de.printStackTrace(System.err);
338             }
339         } /* if we log this level */
340
341     } /* log(int, String, String, String) */
342
343
344     /**
345      * Log a message with the uid and job number recorded as well
346      *
347      * @param newLevel Level of this message
348      * @param objectName Calling object
349      * @param msg Message to log
350      * @param color Color to log the message
351      * @param uid User Name
352      * @param jobNumber Job Number
353      */

354     public static void log(int newLevel, String JavaDoc objectName, String JavaDoc msg,
355                            String JavaDoc color, String JavaDoc uid, String JavaDoc jobNumber) {
356         log("default", "", newLevel, objectName, msg, color, uid, jobNumber);
357     } /* log(int, String, String, String, String, String) */
358
359
360     /**
361      * Log an exception
362      *
363      * @param e Exception to log
364      * @throws LogException If the log entry cannot be written
365      */

366     public static void log(Throwable JavaDoc e)
367             throws LogException {
368         log("default", "", e);
369     } /* log(Throwable) */
370
371
372     /**
373      * Log the given message at the level 0 (e.g. always log)
374      *
375      * @param msg Message to log
376      */

377     public static void log(String JavaDoc msg) {
378         log(0, msg);
379     } /* log(String) */
380
381
382     /**
383      * Log an exception from a particular object
384      *
385      * @param objectName Calling object
386      * @param e Exception to log
387      */

388     public static void log(String JavaDoc objectName, Throwable JavaDoc e)
389             throws LogException {
390         log("default", objectName, e);
391     } /* log(String, Throwable) */
392
393
394     /**
395      * Log the given message at level 0 from the named object
396      *
397      * @param objectName Calling object
398      * @param msg Message to log
399      * @throws LogException if the message cannot be logged
400      */

401     public static void log(String JavaDoc objectName, String JavaDoc msg)
402             throws LogException {
403         log(0, objectName, msg);
404     } /* log(String, String) */
405
406
407     /**
408      * Log an exception from a particular object
409      *
410      * @param dbName
411      * @param channelName
412      * @param level
413      * @param objectName
414      * @param e
415      * @param color
416      * @param uid
417      * @param jobNumber
418      */

419     public static void log(String JavaDoc dbName, String JavaDoc channelName, int level,
420                            String JavaDoc objectName, Throwable JavaDoc e, String JavaDoc color,
421                            String JavaDoc uid, String JavaDoc jobNumber)
422             throws LogException {
423         String JavaDoc myName = (thisClass +
424                 "log(String, String, int, String, Exception," +
425                 "String, String, String)");
426         String JavaDoc message = e.getMessage();
427
428         if (e instanceof DBException) {
429             DBException de = (DBException) e;
430             message = de.getMessage() + ":" + de.getDBMessage();
431         }
432         if (trace) {
433             System.err.println(objectName + ":" + message);
434             e.printStackTrace(System.err);
435         }
436
437         startUp();
438
439         try {
440             LogEntry myLog = new LogEntry();
441             myLog.setDataContext(dbName);
442
443             ByteArrayOutputStream JavaDoc bos = new ByteArrayOutputStream JavaDoc();
444             e.printStackTrace(new PrintStream JavaDoc(bos));
445             myLog.setField("MessageText", bos.toString());
446             myLog.setField("MessageColor", color);
447             myLog.setField("ObjectName", objectName);
448             myLog.setField("LogChannel", channelName);
449             myLog.setField("ExpUid", uid);
450             myLog.setField("JobNumber", jobNumber);
451             myLog.setTimeStamp();
452             myInstance.addToQueue(myLog);
453         } catch (DBException de) {
454             throw new LogException(myName + ":" + de.getMessage());
455         }
456     } /* log(String, String, int, String, Throwable, String, String, String) */
457
458
459     /**
460      * Log a message with the uid and job number recorded as well
461      *
462      * @param dbName Database/config key name to use
463      * @param channelName of this logging "channel"
464      * @param newLevel Level of this message
465      * @param objectName Calling object
466      * @param msg Message to log
467      * @param color Color to log the message
468      * @param uid User Name
469      * @param jobNumber Job Number
470      */

471     public static void log(String JavaDoc dbName, String JavaDoc channelName, int newLevel,
472                            String JavaDoc objectName, String JavaDoc msg, String JavaDoc color,
473                            String JavaDoc uid, String JavaDoc jobNumber) {
474         String JavaDoc myName = (thisClass + "log(String, String, int, " +
475                 "String, String, String, String, String)");
476
477         if (newLevel <= maxLevel) {
478             if (trace) {
479                 System.err.println(objectName + ":" + msg + ":" + uid + ":" +
480                         jobNumber);
481             }
482
483             startUp();
484
485             try {
486                 LogEntry myLog = new LogEntry();
487                 myLog.setDataContext(dbName);
488                 myLog.setField("ObjectName", objectName);
489                 myLog.setField("MessageText", msg);
490                 myLog.setField("MessageColor", encode(color));
491                 myLog.setField("ExpUid", uid);
492                 myLog.setField("JobNumber", jobNumber);
493                 myLog.setField("MessageLevel", "" + newLevel);
494                 myLog.setField("LogChannel", channelName);
495                 myLog.setTimeStamp();
496                 myInstance.addToQueue(myLog);
497             } catch (DBException de) {
498                 System.err.println(myName + ":Unable to log '" + msg + "'");
499                 de.printStackTrace(System.err);
500             }
501         } /* if we log this level */
502
503     } /* log(String, String, int, String, String, String, String, String) */
504
505
506     /**
507      * Log an exception from a particular object
508      *
509      * @param dbName
510      * @param objectName Calling object
511      * @param e Exception to log
512      */

513     public static void log(String JavaDoc dbName, String JavaDoc objectName, Throwable JavaDoc e)
514             throws LogException {
515         String JavaDoc myName = (thisClass + "log(String, Exception)");
516         String JavaDoc message = e.getMessage();
517
518         if (e instanceof DBException) {
519             DBException de = (DBException) e;
520             message = de.getMessage() + ":" + de.getDBMessage();
521         }
522         if (trace) {
523             System.err.println(objectName + ":" + message);
524             e.printStackTrace(System.err);
525         }
526
527         startUp();
528
529         try {
530             LogEntry myLog = new LogEntry();
531             myLog.setDataContext(dbName);
532
533             ByteArrayOutputStream JavaDoc bos = new ByteArrayOutputStream JavaDoc();
534             e.printStackTrace(new PrintStream JavaDoc(bos));
535             myLog.setField("MessageText", bos.toString());
536             myLog.setField("MessageColor", encode("RED"));
537             myLog.setField("ObjectName", objectName);
538             myLog.setTimeStamp();
539             myInstance.addToQueue(myLog);
540         } catch (DBException de) {
541             throw new LogException(myName + ":" + de.getMessage());
542         }
543     } /* log(String, String, Throwable) */
544
545
546     /**
547      * Log the given message from an object at level 0
548      *
549      * @param objectName Calling object
550      * @param msg Message to log
551      * @param color Color to log the message with
552      */

553     public static void log(String JavaDoc objectName, String JavaDoc msg, String JavaDoc color) {
554         log(0, objectName, msg, color);
555     } /* log(String, String, String) */
556
557
558     /**
559      * Log a message at level 0
560      *
561      * @param objectName Calling object
562      * @param msg Message to log
563      * @param color Color to log the message
564      * @param uid User Id
565      * @param jobNumber Job Number
566      */

567     public static void log(String JavaDoc objectName, String JavaDoc msg, String JavaDoc color,
568                            String JavaDoc uid, String JavaDoc jobNumber) {
569         log(0, objectName, msg, color, uid, jobNumber);
570     } /* log(String, String, String, String, String) */
571
572
573     /**
574      * Main thread process of the LogHandler process
575      */

576     public void run() {
577         super.run();
578         String JavaDoc myName = (thisClass + "run()");
579
580         try {
581             log.info(myName + " Log Handler starts");
582
583             if (trace) {
584                 System.err.println(myName + ":Log Handler starts");
585             }
586             while (true) {
587                 if (idleTimes >= maxIdleTimes) {
588                     if (trace) {
589                         System.err.println(myName +
590                                 ":Log handler idle more than " +
591                                 maxIdleTimes +
592                                 " times - shutting down");
593                     }
594
595                     return;
596                 }
597                 try {
598                     checkQueue();
599                 } catch (LogException ae) {
600                     log.error(myName + "Unable to check log queue: " +
601                             ae.getMessage());
602                 }
603
604                 yield();
605                 sleep(sleepTime * 1000);
606             } /* forever */
607
608         } catch (InterruptedException JavaDoc ie) {
609             log.info(myName + ": LogHandler was interrupted:" +
610                     ie.getMessage());
611         } catch (Throwable JavaDoc t) {
612             System.err.println("Test");
613         }
614     } /* run() */
615
616     /**
617      * Set the max size that a log is allowed to reach before it is
618      * auto-archived to the old directory
619      *
620      * @param newMax Max size of the new log in records
621      */

622     public static void setMax(int newMax) {
623         if (newMax < 0) {
624             maxLevel = 0;
625         } else if (newMax > 9) {
626             maxLevel = 9;
627         } else {
628             maxLevel = newMax;
629         }
630     } /* setMax(int) */
631
632     /**
633      * Sets whether the thread, when started will behave in daemon mode or not.
634      * If you're running test cases, you want it true so everything will exit
635      * properly. But in secure environments, some things might not get logged
636      * if you have daemonMode==true. So leave it at it's default of false.
637      */

638     public static void setDaemonMode(boolean newValue) {
639         daemonMode = newValue;
640     }
641
642     /**
643      * This has been semi-deprecated since log4j has been added. Log4j now
644      * controls whether or not something is logged, not the db logging.
645      */

646     private static void setupLevels() {
647         maxLevel = 9;
648
649         //MR String myName = (THIS_CLASS + "setupLevels()");
650
//MR try {
651
//MR String logLev = Setup.getValueRequired("default", "LogLevel");
652
//MR if (logLev.equals("")) {
653
//MR logLev = ("9");
654
//MR }
655
//MR try {
656
//MR setMax(new Integer(logLev).intValue());
657
//MR } catch(NumberFormatException ne) {
658
//MR System.err.println(myName + ":Log level '" + logLev
659
//MR + "' cannot be converted to a number");
660
//MR }
661
//MR } catch(DBException de) {
662
//MR throw new LogException(myName + ":Unable to read setup values", de);
663
//MR }
664
} /* setupLevel() */
665
666
667     /**
668      *
669      *
670      */

671     public synchronized static void startUp() {
672         idleTimes = 0;
673
674         boolean restart = false;
675
676         if (myInstance == null) {
677             restart = true;
678         } else {
679             if (!myInstance.isAlive()) {
680                 restart = true;
681             }
682         }
683         if (restart) {
684             setupLevels();
685             myInstance = new LogHandler();
686             myInstance.setDaemon(daemonMode);
687             myInstance.start();
688         }
689     } /* startUp() */
690
691
692     /**
693      * Log a message at a given level with an objectname, message,
694      * and color. Does not throw exception if message cannot be logged
695      *
696      * @param newLevel
697      * @param objectName
698      * @param msg
699      * @param color
700      */

701     public static void tryLog(int newLevel, String JavaDoc objectName, String JavaDoc msg,
702                               String JavaDoc color) {
703         log(newLevel, objectName, msg, color);
704     } /* tryLog(int, String, String, String) */
705
706     /**
707      * Call to log that does not throw any exception, but writes to standard
708      * error if the message cannot be logged correctly
709      *
710      * @param objectName Name of the object logging the message
711      * @param e Exception being logged
712      */

713     public static void tryLog(String JavaDoc objectName, Exception JavaDoc e) {
714         String JavaDoc myName = (thisClass + "tryLog(String, Exception)");
715         String JavaDoc message = e.getMessage();
716
717         if (e instanceof DBException) {
718             DBException de = (DBException) e;
719             message = de.getMessage() + ":" + de.getDBMessage();
720         }
721         try {
722             startUp();
723             log(objectName, e);
724         } catch (LogException he) {
725             System.err.println(myName + ":Unable to log exception '" +
726                     message + "' from object '" + objectName +
727                     "':" + he.getMessage());
728             he.printStackTrace(System.err);
729             e.printStackTrace(System.err);
730         }
731     } /* tryLog(String, Exception) */
732
733     /**
734      * Try to log the given message from the given object at level 0
735      * but don't throw an exception if it doesn't work
736      *
737      * @param objectName
738      * @param msg
739      */

740     public static void tryLog(String JavaDoc objectName, String JavaDoc msg) {
741         String JavaDoc myName = (thisClass + "tryLog(String, String)");
742
743         try {
744             log(objectName, msg);
745         } catch (LogException he) {
746             System.err.println(myName + ":Unable to log message '" + msg +
747                     "' from object '" + objectName + "':" +
748                     he.getMessage());
749             he.printStackTrace(System.err);
750         }
751     } /* tryLog(String, String) */
752
753     /**
754      * Log a message at a given level with an objectname, message,
755      * and color. Does not throw exception if message cannot be logged
756      *
757      * @param dbName
758      * @param channelName
759      * @param newLevel
760      * @param objectName
761      * @param msg
762      * @param color
763      */

764     public static void tryLog(String JavaDoc dbName, String JavaDoc channelName, int newLevel,
765                               String JavaDoc objectName, String JavaDoc msg, String JavaDoc color) {
766         log(dbName, channelName, newLevel, objectName, msg, color, "", "");
767     } /* tryLog(String, String, int, String, String, String) */
768
769     /**
770      * Log a message at a given level with an objectname, message,
771      * and color. Does not throw exception if message cannot be logged
772      *
773      * @param dbName
774      * @param channelName
775      * @param newLevel
776      * @param objectName
777      * @param msg
778      * @param color
779      * @param newUid
780      * @param newJobNumber
781      */

782     public static void tryLog(String JavaDoc dbName, String JavaDoc channelName, int newLevel,
783                               String JavaDoc objectName, String JavaDoc msg, String JavaDoc color,
784                               String JavaDoc newUid, String JavaDoc newJobNumber) {
785         log(dbName, channelName, newLevel, objectName, msg, color, newUid,
786                 newJobNumber);
787     } /* tryLog(String, String, int, String, String, String, String, String) */
788
789     /**
790      * Try to log a message at level 0 given the objectname, message, and
791      * color. No exception if unable to be logged.
792      *
793      * @param objectName
794      * @param msg
795      * @param color
796      */

797     public static void tryLog(String JavaDoc objectName, String JavaDoc msg, String JavaDoc color) {
798         log(objectName, msg, color);
799     } /* tryLog(String, String, String) */
800
801     /**
802      * Try to log a message given the object, message, color
803      * uid and job number. No exception if message cannot be logged
804      *
805      * @param objectName
806      * @param msg
807      * @param color
808      * @param uid
809      * @param jobNumber
810      */

811     public static void tryLog(String JavaDoc objectName, String JavaDoc msg, String JavaDoc color,
812                               String JavaDoc uid, String JavaDoc jobNumber) {
813         log(objectName, msg, color, uid, jobNumber);
814     } /* tryLog(String, String, String, String, String) */
815
816 } /* LogHandler */
817
Popular Tags