01: /*
02: * Created on Dec 9, 2003
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.log;
08:
09: /**
10: * @author AYegorov
11: *
12: * To change the template for this generated type comment go to
13: * Window>Preferences>Java>Code Generation>Code and Comments
14: */
15:
16: import org.xdev.base.core.IPage;
17: import org.xdev.base.core.object.Configuration;
18: import org.xdev.base.util.ServerUtilities;
19:
20: import org.apache.log4j.*;
21:
22: public class LoggerWriter {
23: public static void log(Configuration c, Object obj) {
24: log(c.getLoggerId(), obj);
25: }
26:
27: public static void log(Object obj) {
28: log(LoggerWriter.class.getName(), obj);
29: }
30:
31: public static void log(Object obj, int level) {
32: log(LoggerWriter.class.getName(), obj, level);
33: }
34:
35: public static void log(String id, Object obj) {
36: log(id, obj, Level.INFO_INT);
37: }
38:
39: public static void log(String id, Object obj, int level) {
40: log(Logger.getLogger(id), obj, level);
41: }
42:
43: public static void log(Object obj, int level, Class cls) {
44: log(cls.getName(), obj, level);
45: }
46:
47: public static void log(Logger logger, Object obj, int level) {
48: switch (level) {
49: case Level.DEBUG_INT:
50: logger.debug(obj);
51: break;
52: case Level.INFO_INT:
53: logger.info(obj);
54: break;
55: case Level.WARN_INT:
56: logger.warn(obj);
57: break;
58: case Level.ERROR_INT:
59: logger.error(obj);
60: break;
61: case Level.FATAL_INT:
62: logger.fatal(obj);
63: break;
64: }
65: }
66: }
|