1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
20:
21: if (function_exists('__autoload')) {
22: trigger_error("log4php: It looks like your code is using an __autoload() function. log4php uses spl_autoload_register() which will bypass your __autoload() function and may break autoloading.", E_USER_WARNING);
23: }
24:
25: spl_autoload_register(array('LoggerAutoloader', 'autoload'));
26:
27: 28: 29: 30: 31: 32: 33:
34: class LoggerAutoloader {
35:
36:
37: private static $classes = array(
38:
39:
40: 'LoggerAppender' => '/LoggerAppender.php',
41: 'LoggerAppenderPool' => '/LoggerAppenderPool.php',
42: 'LoggerConfigurable' => '/LoggerConfigurable.php',
43: 'LoggerConfigurator' => '/LoggerConfigurator.php',
44: 'LoggerException' => '/LoggerException.php',
45: 'LoggerFilter' => '/LoggerFilter.php',
46: 'LoggerHierarchy' => '/LoggerHierarchy.php',
47: 'LoggerLevel' => '/LoggerLevel.php',
48: 'LoggerLocationInfo' => '/LoggerLocationInfo.php',
49: 'LoggerLoggingEvent' => '/LoggerLoggingEvent.php',
50: 'LoggerMDC' => '/LoggerMDC.php',
51: 'LoggerNDC' => '/LoggerNDC.php',
52: 'LoggerLayout' => '/LoggerLayout.php',
53: 'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
54: 'LoggerRoot' => '/LoggerRoot.php',
55: 'LoggerThrowableInformation' => '/LoggerThrowableInformation.php',
56:
57:
58: 'LoggerAppenderConsole' => '/appenders/LoggerAppenderConsole.php',
59: 'LoggerAppenderDailyFile' => '/appenders/LoggerAppenderDailyFile.php',
60: 'LoggerAppenderEcho' => '/appenders/LoggerAppenderEcho.php',
61: 'LoggerAppenderFile' => '/appenders/LoggerAppenderFile.php',
62: 'LoggerAppenderMail' => '/appenders/LoggerAppenderMail.php',
63: 'LoggerAppenderMailEvent' => '/appenders/LoggerAppenderMailEvent.php',
64: 'LoggerAppenderMongoDB' => '/appenders/LoggerAppenderMongoDB.php',
65: 'LoggerAppenderNull' => '/appenders/LoggerAppenderNull.php',
66: 'LoggerAppenderFirePHP' => '/appenders/LoggerAppenderFirePHP.php',
67: 'LoggerAppenderPDO' => '/appenders/LoggerAppenderPDO.php',
68: 'LoggerAppenderPhp' => '/appenders/LoggerAppenderPhp.php',
69: 'LoggerAppenderRollingFile' => '/appenders/LoggerAppenderRollingFile.php',
70: 'LoggerAppenderSocket' => '/appenders/LoggerAppenderSocket.php',
71: 'LoggerAppenderSyslog' => '/appenders/LoggerAppenderSyslog.php',
72:
73:
74: 'LoggerConfigurationAdapter' => '/configurators/LoggerConfigurationAdapter.php',
75: 'LoggerConfigurationAdapterINI' => '/configurators/LoggerConfigurationAdapterINI.php',
76: 'LoggerConfigurationAdapterPHP' => '/configurators/LoggerConfigurationAdapterPHP.php',
77: 'LoggerConfigurationAdapterXML' => '/configurators/LoggerConfigurationAdapterXML.php',
78: 'LoggerConfiguratorDefault' => '/configurators/LoggerConfiguratorDefault.php',
79:
80:
81: 'LoggerFilterDenyAll' => '/filters/LoggerFilterDenyAll.php',
82: 'LoggerFilterLevelMatch' => '/filters/LoggerFilterLevelMatch.php',
83: 'LoggerFilterLevelRange' => '/filters/LoggerFilterLevelRange.php',
84: 'LoggerFilterStringMatch' => '/filters/LoggerFilterStringMatch.php',
85:
86:
87: 'LoggerFormattingInfo' => '/helpers/LoggerFormattingInfo.php',
88: 'LoggerOptionConverter' => '/helpers/LoggerOptionConverter.php',
89: 'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
90: 'LoggerUtils' => '/helpers/LoggerUtils.php',
91:
92:
93: 'LoggerPatternConverter' => '/pattern/LoggerPatternConverter.php',
94: 'LoggerPatternConverterClass' => '/pattern/LoggerPatternConverterClass.php',
95: 'LoggerPatternConverterCookie' => '/pattern/LoggerPatternConverterCookie.php',
96: 'LoggerPatternConverterDate' => '/pattern/LoggerPatternConverterDate.php',
97: 'LoggerPatternConverterEnvironment' => '/pattern/LoggerPatternConverterEnvironment.php',
98: 'LoggerPatternConverterFile' => '/pattern/LoggerPatternConverterFile.php',
99: 'LoggerPatternConverterLevel' => '/pattern/LoggerPatternConverterLevel.php',
100: 'LoggerPatternConverterLine' => '/pattern/LoggerPatternConverterLine.php',
101: 'LoggerPatternConverterLiteral' => '/pattern/LoggerPatternConverterLiteral.php',
102: 'LoggerPatternConverterLocation' => '/pattern/LoggerPatternConverterLocation.php',
103: 'LoggerPatternConverterLogger' => '/pattern/LoggerPatternConverterLogger.php',
104: 'LoggerPatternConverterMDC' => '/pattern/LoggerPatternConverterMDC.php',
105: 'LoggerPatternConverterMessage' => '/pattern/LoggerPatternConverterMessage.php',
106: 'LoggerPatternConverterMethod' => '/pattern/LoggerPatternConverterMethod.php',
107: 'LoggerPatternConverterNDC' => '/pattern/LoggerPatternConverterNDC.php',
108: 'LoggerPatternConverterNewLine' => '/pattern/LoggerPatternConverterNewLine.php',
109: 'LoggerPatternConverterProcess' => '/pattern/LoggerPatternConverterProcess.php',
110: 'LoggerPatternConverterRelative' => '/pattern/LoggerPatternConverterRelative.php',
111: 'LoggerPatternConverterRequest' => '/pattern/LoggerPatternConverterRequest.php',
112: 'LoggerPatternConverterServer' => '/pattern/LoggerPatternConverterServer.php',
113: 'LoggerPatternConverterSession' => '/pattern/LoggerPatternConverterSession.php',
114: 'LoggerPatternConverterSessionID' => '/pattern/LoggerPatternConverterSessionID.php',
115: 'LoggerPatternConverterSuperglobal' => '/pattern/LoggerPatternConverterSuperglobal.php',
116: 'LoggerPatternConverterThrowable' => '/pattern/LoggerPatternConverterThrowable.php',
117:
118:
119: 'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
120: 'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
121: 'LoggerLayoutSerialized' => '/layouts/LoggerLayoutSerialized.php',
122: 'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
123: 'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
124: 'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
125:
126:
127: 'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
128: 'LoggerRendererException' => '/renderers/LoggerRendererException.php',
129: 'LoggerRendererMap' => '/renderers/LoggerRendererMap.php',
130: 'LoggerRenderer' => '/renderers/LoggerRenderer.php',
131: );
132:
133: 134: 135: 136:
137: public static function autoload($className) {
138: if(isset(self::$classes[$className])) {
139: include dirname(__FILE__) . self::$classes[$className];
140: }
141: }
142: }
143: