@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | - * contributor license agreements. See the NOTICE file distributed with |
|
5 | - * this work for additional information regarding copyright ownership. |
|
6 | - * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | - * (the "License"); you may not use this file except in compliance with |
|
8 | - * the License. You may obtain a copy of the License at |
|
9 | - * |
|
10 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | - * |
|
12 | - * Unless required by applicable law or agreed to in writing, software |
|
13 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | - * See the License for the specific language governing permissions and |
|
16 | - * limitations under the License. |
|
17 | - * |
|
18 | - * @package log4php |
|
19 | - */ |
|
3 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | + * contributor license agreements. See the NOTICE file distributed with |
|
5 | + * this work for additional information regarding copyright ownership. |
|
6 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | + * (the "License"); you may not use this file except in compliance with |
|
8 | + * the License. You may obtain a copy of the License at |
|
9 | + * |
|
10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | + * |
|
12 | + * Unless required by applicable law or agreed to in writing, software |
|
13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | + * See the License for the specific language governing permissions and |
|
16 | + * limitations under the License. |
|
17 | + * |
|
18 | + * @package log4php |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Extend this abstract class to create your own log layout format. |
@@ -26,45 +26,45 @@ discard block |
||
26 | 26 | * @abstract |
27 | 27 | */ |
28 | 28 | abstract class LoggerLayout { |
29 | - /** |
|
30 | - * Activates options for this layout. |
|
31 | - * Override this method if you have options to be activated. |
|
32 | - */ |
|
33 | - public function activateOptions() { |
|
34 | - return true; |
|
35 | - } |
|
29 | + /** |
|
30 | + * Activates options for this layout. |
|
31 | + * Override this method if you have options to be activated. |
|
32 | + */ |
|
33 | + public function activateOptions() { |
|
34 | + return true; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Override this method to create your own layout format. |
|
39 | - * |
|
40 | - * @param LoggerLoggingEvent |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function format(LoggerLoggingEvent $event) { |
|
44 | - return $event->getRenderedMessage(); |
|
45 | - } |
|
37 | + /** |
|
38 | + * Override this method to create your own layout format. |
|
39 | + * |
|
40 | + * @param LoggerLoggingEvent |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function format(LoggerLoggingEvent $event) { |
|
44 | + return $event->getRenderedMessage(); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Returns the content type output by this layout. |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function getContentType() { |
|
52 | - return "text/plain"; |
|
53 | - } |
|
47 | + /** |
|
48 | + * Returns the content type output by this layout. |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function getContentType() { |
|
52 | + return "text/plain"; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Returns the footer for the layout format. |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getFooter() { |
|
60 | - return null; |
|
61 | - } |
|
55 | + /** |
|
56 | + * Returns the footer for the layout format. |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getFooter() { |
|
60 | + return null; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Returns the header for the layout format. |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function getHeader() { |
|
68 | - return null; |
|
69 | - } |
|
63 | + /** |
|
64 | + * Returns the header for the layout format. |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function getHeader() { |
|
68 | + return null; |
|
69 | + } |
|
70 | 70 | } |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | - * contributor license agreements. See the NOTICE file distributed with |
|
5 | - * this work for additional information regarding copyright ownership. |
|
6 | - * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | - * (the "License"); you may not use this file except in compliance with |
|
8 | - * the License. You may obtain a copy of the License at |
|
9 | - * |
|
10 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | - * |
|
12 | - * Unless required by applicable law or agreed to in writing, software |
|
13 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | - * See the License for the specific language governing permissions and |
|
16 | - * limitations under the License. |
|
17 | - * |
|
18 | - * @package log4php |
|
19 | - */ |
|
3 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | + * contributor license agreements. See the NOTICE file distributed with |
|
5 | + * this work for additional information regarding copyright ownership. |
|
6 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | + * (the "License"); you may not use this file except in compliance with |
|
8 | + * the License. You may obtain a copy of the License at |
|
9 | + * |
|
10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | + * |
|
12 | + * Unless required by applicable law or agreed to in writing, software |
|
13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | + * See the License for the specific language governing permissions and |
|
16 | + * limitations under the License. |
|
17 | + * |
|
18 | + * @package log4php |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Log objects using customized renderers that implement {@link LoggerRendererObject}. |
@@ -36,114 +36,114 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class LoggerRendererMap { |
38 | 38 | |
39 | - /** |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - private $map; |
|
39 | + /** |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + private $map; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var LoggerDefaultRenderer |
|
46 | - */ |
|
47 | - private $defaultRenderer; |
|
44 | + /** |
|
45 | + * @var LoggerDefaultRenderer |
|
46 | + */ |
|
47 | + private $defaultRenderer; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor |
|
51 | - */ |
|
52 | - public function __construct() { |
|
53 | - $this->map = array(); |
|
54 | - $this->defaultRenderer = new LoggerRendererDefault(); |
|
55 | - } |
|
49 | + /** |
|
50 | + * Constructor |
|
51 | + */ |
|
52 | + public function __construct() { |
|
53 | + $this->map = array(); |
|
54 | + $this->defaultRenderer = new LoggerRendererDefault(); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Add a renderer to a hierarchy passed as parameter. |
|
59 | - * Note that hierarchy must implement getRendererMap() and setRenderer() methods. |
|
60 | - * |
|
61 | - * @param LoggerHierarchy $repository a logger repository. |
|
62 | - * @param string $renderedClassName |
|
63 | - * @param string $renderingClassName |
|
64 | - * @static |
|
65 | - */ |
|
66 | - public function addRenderer($renderedClassName, $renderingClassName) { |
|
67 | - $renderer = LoggerReflectionUtils::createObject($renderingClassName); |
|
68 | - if($renderer == null) { |
|
69 | - return; |
|
70 | - } else { |
|
71 | - $this->put($renderedClassName, $renderer); |
|
72 | - } |
|
73 | - } |
|
57 | + /** |
|
58 | + * Add a renderer to a hierarchy passed as parameter. |
|
59 | + * Note that hierarchy must implement getRendererMap() and setRenderer() methods. |
|
60 | + * |
|
61 | + * @param LoggerHierarchy $repository a logger repository. |
|
62 | + * @param string $renderedClassName |
|
63 | + * @param string $renderingClassName |
|
64 | + * @static |
|
65 | + */ |
|
66 | + public function addRenderer($renderedClassName, $renderingClassName) { |
|
67 | + $renderer = LoggerReflectionUtils::createObject($renderingClassName); |
|
68 | + if($renderer == null) { |
|
69 | + return; |
|
70 | + } else { |
|
71 | + $this->put($renderedClassName, $renderer); |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Find the appropriate renderer for the class type of the |
|
78 | - * <var>o</var> parameter. |
|
79 | - * |
|
80 | - * This is accomplished by calling the {@link getByObject()} |
|
81 | - * method if <var>o</var> is object or using {@link LoggerRendererDefault}. |
|
82 | - * Once a renderer is found, it is applied on the object <var>o</var> and |
|
83 | - * the result is returned as a string. |
|
84 | - * |
|
85 | - * @param mixed $o |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - public function findAndRender($o) { |
|
89 | - if($o == null) { |
|
90 | - return null; |
|
91 | - } else { |
|
92 | - if(is_object($o)) { |
|
93 | - $renderer = $this->getByObject($o); |
|
94 | - if($renderer !== null) { |
|
95 | - return $renderer->render($o); |
|
96 | - } else { |
|
97 | - return null; |
|
98 | - } |
|
99 | - } else { |
|
100 | - $renderer = $this->defaultRenderer; |
|
101 | - return $renderer->render($o); |
|
102 | - } |
|
103 | - } |
|
104 | - } |
|
76 | + /** |
|
77 | + * Find the appropriate renderer for the class type of the |
|
78 | + * <var>o</var> parameter. |
|
79 | + * |
|
80 | + * This is accomplished by calling the {@link getByObject()} |
|
81 | + * method if <var>o</var> is object or using {@link LoggerRendererDefault}. |
|
82 | + * Once a renderer is found, it is applied on the object <var>o</var> and |
|
83 | + * the result is returned as a string. |
|
84 | + * |
|
85 | + * @param mixed $o |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + public function findAndRender($o) { |
|
89 | + if($o == null) { |
|
90 | + return null; |
|
91 | + } else { |
|
92 | + if(is_object($o)) { |
|
93 | + $renderer = $this->getByObject($o); |
|
94 | + if($renderer !== null) { |
|
95 | + return $renderer->render($o); |
|
96 | + } else { |
|
97 | + return null; |
|
98 | + } |
|
99 | + } else { |
|
100 | + $renderer = $this->defaultRenderer; |
|
101 | + return $renderer->render($o); |
|
102 | + } |
|
103 | + } |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the |
|
108 | - * class of the object parameter. |
|
109 | - * |
|
110 | - * @param mixed $o |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - public function getByObject($o) { |
|
114 | - return ($o == null) ? null : $this->getByClassName(get_class($o)); |
|
115 | - } |
|
106 | + /** |
|
107 | + * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the |
|
108 | + * class of the object parameter. |
|
109 | + * |
|
110 | + * @param mixed $o |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + public function getByObject($o) { |
|
114 | + return ($o == null) ? null : $this->getByClassName(get_class($o)); |
|
115 | + } |
|
116 | 116 | |
117 | 117 | |
118 | - /** |
|
119 | - * Search the parents of <var>clazz</var> for a renderer. |
|
120 | - * |
|
121 | - * The renderer closest in the hierarchy will be returned. If no |
|
122 | - * renderers could be found, then the default renderer is returned. |
|
123 | - * |
|
124 | - * @param string $class |
|
125 | - * @return LoggerRendererObject |
|
126 | - */ |
|
127 | - public function getByClassName($class) { |
|
128 | - $r = null; |
|
129 | - for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) { |
|
130 | - if(isset($this->map[$c])) { |
|
131 | - return $this->map[$c]; |
|
132 | - } |
|
133 | - } |
|
134 | - return $this->defaultRenderer; |
|
135 | - } |
|
118 | + /** |
|
119 | + * Search the parents of <var>clazz</var> for a renderer. |
|
120 | + * |
|
121 | + * The renderer closest in the hierarchy will be returned. If no |
|
122 | + * renderers could be found, then the default renderer is returned. |
|
123 | + * |
|
124 | + * @param string $class |
|
125 | + * @return LoggerRendererObject |
|
126 | + */ |
|
127 | + public function getByClassName($class) { |
|
128 | + $r = null; |
|
129 | + for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) { |
|
130 | + if(isset($this->map[$c])) { |
|
131 | + return $this->map[$c]; |
|
132 | + } |
|
133 | + } |
|
134 | + return $this->defaultRenderer; |
|
135 | + } |
|
136 | 136 | |
137 | - public function clear() { |
|
138 | - $this->map = array(); |
|
139 | - } |
|
137 | + public function clear() { |
|
138 | + $this->map = array(); |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Register a {@link LoggerRendererObject} for <var>clazz</var>. |
|
143 | - * @param string $class |
|
144 | - * @param LoggerRendererObject $or |
|
145 | - */ |
|
146 | - private function put($class, $or) { |
|
147 | - $this->map[strtolower($class)] = $or; |
|
148 | - } |
|
141 | + /** |
|
142 | + * Register a {@link LoggerRendererObject} for <var>clazz</var>. |
|
143 | + * @param string $class |
|
144 | + * @param LoggerRendererObject $or |
|
145 | + */ |
|
146 | + private function put($class, $or) { |
|
147 | + $this->map[strtolower($class)] = $or; |
|
148 | + } |
|
149 | 149 | } |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | - * contributor license agreements. See the NOTICE file distributed with |
|
5 | - * this work for additional information regarding copyright ownership. |
|
6 | - * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | - * (the "License"); you may not use this file except in compliance with |
|
8 | - * the License. You may obtain a copy of the License at |
|
9 | - * |
|
10 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | - * |
|
12 | - * Unless required by applicable law or agreed to in writing, software |
|
13 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | - * See the License for the specific language governing permissions and |
|
16 | - * limitations under the License. |
|
17 | - * |
|
18 | - * @package log4php |
|
19 | - */ |
|
3 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | + * contributor license agreements. See the NOTICE file distributed with |
|
5 | + * this work for additional information regarding copyright ownership. |
|
6 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | + * (the "License"); you may not use this file except in compliance with |
|
8 | + * the License. You may obtain a copy of the License at |
|
9 | + * |
|
10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | + * |
|
12 | + * Unless required by applicable law or agreed to in writing, software |
|
13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | + * See the License for the specific language governing permissions and |
|
16 | + * limitations under the License. |
|
17 | + * |
|
18 | + * @package log4php |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * The default Renderer renders objects by type casting. |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | */ |
40 | 40 | class LoggerRendererDefault implements LoggerRendererObject { |
41 | 41 | |
42 | - /** |
|
43 | - * Render objects by type casting |
|
44 | - * |
|
45 | - * @param mixed $o the object to render |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function render($o) { |
|
49 | - return var_export($o, true); |
|
50 | - } |
|
42 | + /** |
|
43 | + * Render objects by type casting |
|
44 | + * |
|
45 | + * @param mixed $o the object to render |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function render($o) { |
|
49 | + return var_export($o, true); |
|
50 | + } |
|
51 | 51 | } |
@@ -53,160 +53,160 @@ |
||
53 | 53 | */ |
54 | 54 | class LoggerAppenderSyslog extends LoggerAppender { |
55 | 55 | |
56 | - /** |
|
57 | - * The ident string is added to each message. Typically the name of your application. |
|
58 | - * |
|
59 | - * @var string Ident for your application |
|
60 | - */ |
|
61 | - private $_ident = "Log4PHP Syslog-Event"; |
|
56 | + /** |
|
57 | + * The ident string is added to each message. Typically the name of your application. |
|
58 | + * |
|
59 | + * @var string Ident for your application |
|
60 | + */ |
|
61 | + private $_ident = "Log4PHP Syslog-Event"; |
|
62 | 62 | |
63 | - /** |
|
64 | - * The priority parameter value indicates the level of importance of the message. |
|
65 | - * It is passed on to the Syslog daemon. |
|
66 | - * |
|
67 | - * @var int Syslog priority |
|
68 | - */ |
|
69 | - private $_priority; |
|
63 | + /** |
|
64 | + * The priority parameter value indicates the level of importance of the message. |
|
65 | + * It is passed on to the Syslog daemon. |
|
66 | + * |
|
67 | + * @var int Syslog priority |
|
68 | + */ |
|
69 | + private $_priority; |
|
70 | 70 | |
71 | - /** |
|
72 | - * The option used when generating a log message. |
|
73 | - * It is passed on to the Syslog daemon. |
|
74 | - * |
|
75 | - * @var int Syslog priority |
|
76 | - */ |
|
77 | - private $_option; |
|
71 | + /** |
|
72 | + * The option used when generating a log message. |
|
73 | + * It is passed on to the Syslog daemon. |
|
74 | + * |
|
75 | + * @var int Syslog priority |
|
76 | + */ |
|
77 | + private $_option; |
|
78 | 78 | |
79 | - /** |
|
80 | - * The facility value indicates the source of the message. |
|
81 | - * It is passed on to the Syslog daemon. |
|
82 | - * |
|
83 | - * @var const int Syslog facility |
|
84 | - */ |
|
85 | - private $_facility; |
|
79 | + /** |
|
80 | + * The facility value indicates the source of the message. |
|
81 | + * It is passed on to the Syslog daemon. |
|
82 | + * |
|
83 | + * @var const int Syslog facility |
|
84 | + */ |
|
85 | + private $_facility; |
|
86 | 86 | |
87 | - /** |
|
88 | - * If it is necessary to define logging priority in the .properties-file, |
|
89 | - * set this variable to "true". |
|
90 | - * |
|
91 | - * @var const int value indicating whether the priority of the message is defined in the .properties-file |
|
92 | - * (or properties-array) |
|
93 | - */ |
|
94 | - private $_overridePriority; |
|
87 | + /** |
|
88 | + * If it is necessary to define logging priority in the .properties-file, |
|
89 | + * set this variable to "true". |
|
90 | + * |
|
91 | + * @var const int value indicating whether the priority of the message is defined in the .properties-file |
|
92 | + * (or properties-array) |
|
93 | + */ |
|
94 | + private $_overridePriority; |
|
95 | 95 | |
96 | - /** @var indiciates if this appender should run in dry mode */ |
|
97 | - private $dry = false; |
|
96 | + /** @var indiciates if this appender should run in dry mode */ |
|
97 | + private $dry = false; |
|
98 | 98 | |
99 | - public function __construct($name = '') { |
|
100 | - parent::__construct($name); |
|
101 | - $this->requiresLayout = true; |
|
102 | - } |
|
99 | + public function __construct($name = '') { |
|
100 | + parent::__construct($name); |
|
101 | + $this->requiresLayout = true; |
|
102 | + } |
|
103 | 103 | |
104 | - public function __destruct() { |
|
105 | - $this->close(); |
|
106 | - } |
|
104 | + public function __destruct() { |
|
105 | + $this->close(); |
|
106 | + } |
|
107 | 107 | |
108 | - public function setDry($dry) { |
|
109 | - $this->dry = $dry; |
|
110 | - } |
|
108 | + public function setDry($dry) { |
|
109 | + $this->dry = $dry; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * Set the ident of the syslog message. |
|
114 | - * |
|
115 | - * @param string Ident |
|
116 | - */ |
|
117 | - public function setIdent($ident) { |
|
118 | - $this->_ident = $ident; |
|
119 | - } |
|
112 | + /** |
|
113 | + * Set the ident of the syslog message. |
|
114 | + * |
|
115 | + * @param string Ident |
|
116 | + */ |
|
117 | + public function setIdent($ident) { |
|
118 | + $this->_ident = $ident; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Set the priority value for the syslog message. |
|
123 | - * |
|
124 | - * @param const int Priority |
|
125 | - */ |
|
126 | - public function setPriority($priority) { |
|
127 | - $this->_priority = $priority; |
|
128 | - } |
|
121 | + /** |
|
122 | + * Set the priority value for the syslog message. |
|
123 | + * |
|
124 | + * @param const int Priority |
|
125 | + */ |
|
126 | + public function setPriority($priority) { |
|
127 | + $this->_priority = $priority; |
|
128 | + } |
|
129 | 129 | |
130 | 130 | |
131 | - /** |
|
132 | - * Set the facility value for the syslog message. |
|
133 | - * |
|
134 | - * @param const int Facility |
|
135 | - */ |
|
136 | - public function setFacility($facility) { |
|
137 | - $this->_facility = $facility; |
|
138 | - } |
|
131 | + /** |
|
132 | + * Set the facility value for the syslog message. |
|
133 | + * |
|
134 | + * @param const int Facility |
|
135 | + */ |
|
136 | + public function setFacility($facility) { |
|
137 | + $this->_facility = $facility; |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * If the priority of the message to be sent can be defined by a value in the properties-file, |
|
142 | - * set parameter value to "true". |
|
143 | - * |
|
144 | - * @param bool Override priority |
|
145 | - */ |
|
146 | - public function setOverridePriority($overridePriority) { |
|
147 | - $this->_overridePriority = $overridePriority; |
|
148 | - } |
|
140 | + /** |
|
141 | + * If the priority of the message to be sent can be defined by a value in the properties-file, |
|
142 | + * set parameter value to "true". |
|
143 | + * |
|
144 | + * @param bool Override priority |
|
145 | + */ |
|
146 | + public function setOverridePriority($overridePriority) { |
|
147 | + $this->_overridePriority = $overridePriority; |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Set the option value for the syslog message. |
|
152 | - * This value is used as a parameter for php openlog() |
|
153 | - * and passed on to the syslog daemon. |
|
154 | - * |
|
155 | - * @param string $option |
|
156 | - */ |
|
157 | - public function setOption($option) { |
|
158 | - $this->_option = $option; |
|
159 | - } |
|
150 | + /** |
|
151 | + * Set the option value for the syslog message. |
|
152 | + * This value is used as a parameter for php openlog() |
|
153 | + * and passed on to the syslog daemon. |
|
154 | + * |
|
155 | + * @param string $option |
|
156 | + */ |
|
157 | + public function setOption($option) { |
|
158 | + $this->_option = $option; |
|
159 | + } |
|
160 | 160 | |
161 | - public function activateOptions() { |
|
162 | - // Deprecated as of 5.3 and removed in 6.0 |
|
163 | - // define_syslog_variables(); |
|
164 | - $this->closed = false; |
|
165 | - } |
|
161 | + public function activateOptions() { |
|
162 | + // Deprecated as of 5.3 and removed in 6.0 |
|
163 | + // define_syslog_variables(); |
|
164 | + $this->closed = false; |
|
165 | + } |
|
166 | 166 | |
167 | - public function close() { |
|
168 | - if($this->closed != true) { |
|
169 | - closelog(); |
|
170 | - $this->closed = true; |
|
171 | - } |
|
172 | - } |
|
167 | + public function close() { |
|
168 | + if($this->closed != true) { |
|
169 | + closelog(); |
|
170 | + $this->closed = true; |
|
171 | + } |
|
172 | + } |
|
173 | 173 | |
174 | - public function append(LoggerLoggingEvent $event) { |
|
175 | - if($this->_option == NULL){ |
|
176 | - $this->_option = LOG_PID | LOG_CONS; |
|
177 | - } |
|
174 | + public function append(LoggerLoggingEvent $event) { |
|
175 | + if($this->_option == NULL){ |
|
176 | + $this->_option = LOG_PID | LOG_CONS; |
|
177 | + } |
|
178 | 178 | |
179 | - $level = $event->getLevel(); |
|
180 | - if($this->layout === null) { |
|
181 | - $message = $event->getRenderedMessage(); |
|
182 | - } else { |
|
183 | - $message = $this->layout->format($event); |
|
184 | - } |
|
179 | + $level = $event->getLevel(); |
|
180 | + if($this->layout === null) { |
|
181 | + $message = $event->getRenderedMessage(); |
|
182 | + } else { |
|
183 | + $message = $this->layout->format($event); |
|
184 | + } |
|
185 | 185 | |
186 | - // If the priority of a syslog message can be overridden by a value defined in the properties-file, |
|
187 | - // use that value, else use the one that is defined in the code. |
|
188 | - if(!$this->dry) { |
|
189 | - // Attach the process ID to the message, use the facility defined in the .properties-file |
|
190 | - openlog($this->_ident, $this->_option, $this->_facility); |
|
186 | + // If the priority of a syslog message can be overridden by a value defined in the properties-file, |
|
187 | + // use that value, else use the one that is defined in the code. |
|
188 | + if(!$this->dry) { |
|
189 | + // Attach the process ID to the message, use the facility defined in the .properties-file |
|
190 | + openlog($this->_ident, $this->_option, $this->_facility); |
|
191 | 191 | |
192 | - if($this->_overridePriority) { |
|
193 | - syslog($this->_priority, $message); |
|
194 | - } else { |
|
195 | - if($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) { |
|
196 | - syslog(LOG_ALERT, $message); |
|
197 | - } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
198 | - syslog(LOG_ERR, $message); |
|
199 | - } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
200 | - syslog(LOG_WARNING, $message); |
|
201 | - } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) { |
|
202 | - syslog(LOG_INFO, $message); |
|
203 | - } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) { |
|
204 | - syslog(LOG_DEBUG, $message); |
|
205 | - } |
|
206 | - } |
|
207 | - closelog(); |
|
208 | - } else { |
|
209 | - echo "DRY MODE OF SYSLOG APPENDER: ".$message; |
|
210 | - } |
|
211 | - } |
|
192 | + if($this->_overridePriority) { |
|
193 | + syslog($this->_priority, $message); |
|
194 | + } else { |
|
195 | + if($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) { |
|
196 | + syslog(LOG_ALERT, $message); |
|
197 | + } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
198 | + syslog(LOG_ERR, $message); |
|
199 | + } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
200 | + syslog(LOG_WARNING, $message); |
|
201 | + } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) { |
|
202 | + syslog(LOG_INFO, $message); |
|
203 | + } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) { |
|
204 | + syslog(LOG_DEBUG, $message); |
|
205 | + } |
|
206 | + } |
|
207 | + closelog(); |
|
208 | + } else { |
|
209 | + echo "DRY MODE OF SYSLOG APPENDER: ".$message; |
|
210 | + } |
|
211 | + } |
|
212 | 212 | } |
@@ -121,10 +121,10 @@ |
||
121 | 121 | { |
122 | 122 | $this->db = &ADONewConnection($this->type); |
123 | 123 | if (! $this->db->PConnect($this->host, $this->user, $this->password, $this->database)) { |
124 | - $this->db = null; |
|
125 | - $this->closed = true; |
|
126 | - $this->canAppend = false; |
|
127 | - return; |
|
124 | + $this->db = null; |
|
125 | + $this->closed = true; |
|
126 | + $this->canAppend = false; |
|
127 | + return; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $this->layout = LoggerReflectionUtils::createObject('LoggerLayoutPattern'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | /** Create the log table if it does not exists (optional). |
50 | 50 | * @var string */ |
51 | - private $createTable = true; |
|
51 | + private $createTable = true; |
|
52 | 52 | |
53 | 53 | /** Database user name. |
54 | 54 | * @var string */ |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $this->requiresLayout = false; |
102 | 102 | } |
103 | 103 | |
104 | - public function __destruct() { |
|
105 | - $this->close(); |
|
106 | - } |
|
104 | + public function __destruct() { |
|
105 | + $this->close(); |
|
106 | + } |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Setup db connection. |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function activateOptions() { |
116 | 116 | try { |
117 | - if($this->user === null) { |
|
118 | - $this->db = new PDO($this->dsn); |
|
119 | - } else if($this->password === null) { |
|
120 | - $this->db = new PDO($this->dsn, $this->user); |
|
121 | - } else { |
|
122 | - $this->db = new PDO($this->dsn,$this->user,$this->password); |
|
123 | - } |
|
124 | - $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
117 | + if($this->user === null) { |
|
118 | + $this->db = new PDO($this->dsn); |
|
119 | + } else if($this->password === null) { |
|
120 | + $this->db = new PDO($this->dsn, $this->user); |
|
121 | + } else { |
|
122 | + $this->db = new PDO($this->dsn,$this->user,$this->password); |
|
123 | + } |
|
124 | + $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
125 | 125 | |
126 | 126 | // test if log table exists |
127 | 127 | try { |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | // The syntax should at least be compatible with MySQL, PostgreSQL, SQLite and Oracle. |
137 | 137 | $query = "CREATE TABLE {$this->table} (". |
138 | 138 | "timestamp varchar(32)," . |
139 | - "logger varchar(64)," . |
|
140 | - "level varchar(32)," . |
|
141 | - "message varchar(9999)," . |
|
142 | - "thread varchar(32)," . |
|
143 | - "file varchar(255)," . |
|
144 | - "line varchar(6))"; |
|
139 | + "logger varchar(64)," . |
|
140 | + "level varchar(32)," . |
|
141 | + "message varchar(9999)," . |
|
142 | + "thread varchar(32)," . |
|
143 | + "file varchar(255)," . |
|
144 | + "line varchar(6))"; |
|
145 | 145 | $result = $this->db->query($query); |
146 | 146 | } |
147 | 147 | } catch (PDOException $e) { |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | * Closes the connection to the logging database |
198 | 198 | */ |
199 | 199 | public function close() { |
200 | - if($this->closed != true) { |
|
201 | - if ($this->db !== null) { |
|
202 | - $db = null; |
|
203 | - } |
|
204 | - $this->closed = true; |
|
205 | - } |
|
200 | + if($this->closed != true) { |
|
201 | + if ($this->db !== null) { |
|
202 | + $db = null; |
|
203 | + } |
|
204 | + $this->closed = true; |
|
205 | + } |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -229,19 +229,19 @@ discard block |
||
229 | 229 | $this->createTable = LoggerOptionConverter::toBoolean($flag, true); |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Sets the SQL string into which the event should be transformed. |
|
234 | - * Defaults to: |
|
235 | - * |
|
236 | - * INSERT INTO $this->table |
|
237 | - * ( timestamp, logger, level, message, thread, file, line) |
|
238 | - * VALUES |
|
239 | - * ('%d','%c','%p','%m','%t','%F','%L') |
|
240 | - * |
|
241 | - * It's not necessary to change this except you have customized logging' |
|
242 | - * |
|
243 | - * @deprecated See {@link setInsertSql} and {@link setInsertPattern}. |
|
244 | - */ |
|
232 | + /** |
|
233 | + * Sets the SQL string into which the event should be transformed. |
|
234 | + * Defaults to: |
|
235 | + * |
|
236 | + * INSERT INTO $this->table |
|
237 | + * ( timestamp, logger, level, message, thread, file, line) |
|
238 | + * VALUES |
|
239 | + * ('%d','%c','%p','%m','%t','%F','%L') |
|
240 | + * |
|
241 | + * It's not necessary to change this except you have customized logging' |
|
242 | + * |
|
243 | + * @deprecated See {@link setInsertSql} and {@link setInsertPattern}. |
|
244 | + */ |
|
245 | 245 | public function setSql($sql) { |
246 | 246 | $this->sql = $sql; |
247 | 247 | } |
@@ -35,26 +35,26 @@ |
||
35 | 35 | */ |
36 | 36 | class LoggerAppenderNull extends LoggerAppender { |
37 | 37 | |
38 | - protected $requiresLayout = false; |
|
38 | + protected $requiresLayout = false; |
|
39 | 39 | |
40 | - public function __destruct() { |
|
41 | - $this->close(); |
|
42 | - } |
|
40 | + public function __destruct() { |
|
41 | + $this->close(); |
|
42 | + } |
|
43 | 43 | |
44 | - public function activateOptions() { |
|
45 | - $this->closed = false; |
|
46 | - } |
|
44 | + public function activateOptions() { |
|
45 | + $this->closed = false; |
|
46 | + } |
|
47 | 47 | |
48 | - public function close() { |
|
49 | - $this->closed = true; |
|
50 | - } |
|
48 | + public function close() { |
|
49 | + $this->closed = true; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Do nothing. |
|
54 | - * |
|
55 | - * @param LoggerLoggingEvent $event |
|
56 | - */ |
|
57 | - public function append(LoggerLoggingEvent $event) { |
|
58 | - } |
|
52 | + /** |
|
53 | + * Do nothing. |
|
54 | + * |
|
55 | + * @param LoggerLoggingEvent $event |
|
56 | + */ |
|
57 | + public function append(LoggerLoggingEvent $event) { |
|
58 | + } |
|
59 | 59 | } |
60 | 60 |
@@ -25,31 +25,31 @@ |
||
25 | 25 | * @package log4php |
26 | 26 | */ |
27 | 27 | class LoggerAppenderPool { |
28 | - /* Appender Pool */ |
|
29 | - public static $appenderPool = null; |
|
28 | + /* Appender Pool */ |
|
29 | + public static $appenderPool = null; |
|
30 | 30 | |
31 | - /** |
|
32 | - * |
|
33 | - * |
|
34 | - * @param string $name |
|
35 | - * @param string $class |
|
36 | - * @return LoggerAppender |
|
37 | - */ |
|
38 | - public static function getAppenderFromPool($name, $class = '') { |
|
39 | - if(isset(self::$appenderPool[$name])) { |
|
40 | - return self::$appenderPool[$name]; |
|
41 | - } |
|
31 | + /** |
|
32 | + * |
|
33 | + * |
|
34 | + * @param string $name |
|
35 | + * @param string $class |
|
36 | + * @return LoggerAppender |
|
37 | + */ |
|
38 | + public static function getAppenderFromPool($name, $class = '') { |
|
39 | + if(isset(self::$appenderPool[$name])) { |
|
40 | + return self::$appenderPool[$name]; |
|
41 | + } |
|
42 | 42 | |
43 | - if(empty($class)) { |
|
44 | - return null; |
|
45 | - } |
|
43 | + if(empty($class)) { |
|
44 | + return null; |
|
45 | + } |
|
46 | 46 | |
47 | - $appender = LoggerReflectionUtils::createObject($class); |
|
48 | - $appender->setName($name); |
|
49 | - if($appender !== null) { |
|
50 | - self::$appenderPool[$name] = $appender; |
|
51 | - return self::$appenderPool[$name]; |
|
52 | - } |
|
53 | - return null; |
|
54 | - } |
|
47 | + $appender = LoggerReflectionUtils::createObject($class); |
|
48 | + $appender->setName($name); |
|
49 | + if($appender !== null) { |
|
50 | + self::$appenderPool[$name] = $appender; |
|
51 | + return self::$appenderPool[$name]; |
|
52 | + } |
|
53 | + return null; |
|
54 | + } |
|
55 | 55 | } |
@@ -100,122 +100,122 @@ |
||
100 | 100 | * @since 0.3 |
101 | 101 | */ |
102 | 102 | class LoggerNDC { |
103 | - const HT_SIZE = 7; |
|
104 | - /** |
|
105 | - * Clear any nested diagnostic information if any. This method is |
|
106 | - * useful in cases where the same thread can be potentially used |
|
107 | - * over and over in different unrelated contexts. |
|
108 | - * |
|
109 | - * <p>This method is equivalent to calling the {@link setMaxDepth()} |
|
110 | - * method with a zero <var>maxDepth</var> argument. |
|
111 | - * |
|
112 | - * @static |
|
113 | - */ |
|
114 | - public static function clear() { |
|
115 | - $GLOBALS['log4php.LoggerNDC.ht'] = array(); |
|
116 | - } |
|
103 | + const HT_SIZE = 7; |
|
104 | + /** |
|
105 | + * Clear any nested diagnostic information if any. This method is |
|
106 | + * useful in cases where the same thread can be potentially used |
|
107 | + * over and over in different unrelated contexts. |
|
108 | + * |
|
109 | + * <p>This method is equivalent to calling the {@link setMaxDepth()} |
|
110 | + * method with a zero <var>maxDepth</var> argument. |
|
111 | + * |
|
112 | + * @static |
|
113 | + */ |
|
114 | + public static function clear() { |
|
115 | + $GLOBALS['log4php.LoggerNDC.ht'] = array(); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead. |
|
120 | - * @static |
|
121 | - * @return array |
|
122 | - */ |
|
123 | - public static function get() { |
|
124 | - if(!array_key_exists('log4php.LoggerNDC.ht', $GLOBALS)) { |
|
125 | - LoggerNDC::clear(); |
|
126 | - } |
|
127 | - return $GLOBALS['log4php.LoggerNDC.ht']; |
|
128 | - } |
|
118 | + /** |
|
119 | + * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead. |
|
120 | + * @static |
|
121 | + * @return array |
|
122 | + */ |
|
123 | + public static function get() { |
|
124 | + if(!array_key_exists('log4php.LoggerNDC.ht', $GLOBALS)) { |
|
125 | + LoggerNDC::clear(); |
|
126 | + } |
|
127 | + return $GLOBALS['log4php.LoggerNDC.ht']; |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Get the current nesting depth of this diagnostic context. |
|
132 | - * |
|
133 | - * @see setMaxDepth() |
|
134 | - * @return integer |
|
135 | - * @static |
|
136 | - */ |
|
137 | - public static function getDepth() { |
|
138 | - return count($GLOBALS['log4php.LoggerNDC.ht']); |
|
139 | - } |
|
130 | + /** |
|
131 | + * Get the current nesting depth of this diagnostic context. |
|
132 | + * |
|
133 | + * @see setMaxDepth() |
|
134 | + * @return integer |
|
135 | + * @static |
|
136 | + */ |
|
137 | + public static function getDepth() { |
|
138 | + return count($GLOBALS['log4php.LoggerNDC.ht']); |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Clients should call this method before leaving a diagnostic |
|
143 | - * context. |
|
144 | - * |
|
145 | - * <p>The returned value is the value that was pushed last. If no |
|
146 | - * context is available, then the empty string "" is returned.</p> |
|
147 | - * |
|
148 | - * @return string The innermost diagnostic context. |
|
149 | - * @static |
|
150 | - */ |
|
151 | - public static function pop() { |
|
152 | - if(count($GLOBALS['log4php.LoggerNDC.ht']) > 0) { |
|
153 | - return array_pop($GLOBALS['log4php.LoggerNDC.ht']); |
|
154 | - } else { |
|
155 | - return ''; |
|
156 | - } |
|
157 | - } |
|
141 | + /** |
|
142 | + * Clients should call this method before leaving a diagnostic |
|
143 | + * context. |
|
144 | + * |
|
145 | + * <p>The returned value is the value that was pushed last. If no |
|
146 | + * context is available, then the empty string "" is returned.</p> |
|
147 | + * |
|
148 | + * @return string The innermost diagnostic context. |
|
149 | + * @static |
|
150 | + */ |
|
151 | + public static function pop() { |
|
152 | + if(count($GLOBALS['log4php.LoggerNDC.ht']) > 0) { |
|
153 | + return array_pop($GLOBALS['log4php.LoggerNDC.ht']); |
|
154 | + } else { |
|
155 | + return ''; |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * Looks at the last diagnostic context at the top of this NDC |
|
161 | - * without removing it. |
|
162 | - * |
|
163 | - * <p>The returned value is the value that was pushed last. If no |
|
164 | - * context is available, then the empty string "" is returned.</p> |
|
165 | - * @return string The innermost diagnostic context. |
|
166 | - * @static |
|
167 | - */ |
|
168 | - public static function peek(){ |
|
169 | - if(count($GLOBALS['log4php.LoggerNDC.ht']) > 0) { |
|
170 | - return end($GLOBALS['log4php.LoggerNDC.ht']); |
|
171 | - } else { |
|
172 | - return ''; |
|
173 | - } |
|
174 | - } |
|
159 | + /** |
|
160 | + * Looks at the last diagnostic context at the top of this NDC |
|
161 | + * without removing it. |
|
162 | + * |
|
163 | + * <p>The returned value is the value that was pushed last. If no |
|
164 | + * context is available, then the empty string "" is returned.</p> |
|
165 | + * @return string The innermost diagnostic context. |
|
166 | + * @static |
|
167 | + */ |
|
168 | + public static function peek(){ |
|
169 | + if(count($GLOBALS['log4php.LoggerNDC.ht']) > 0) { |
|
170 | + return end($GLOBALS['log4php.LoggerNDC.ht']); |
|
171 | + } else { |
|
172 | + return ''; |
|
173 | + } |
|
174 | + } |
|
175 | 175 | |
176 | - /** |
|
177 | - * Push new diagnostic context information for the current thread. |
|
178 | - * |
|
179 | - * <p>The contents of the <var>message</var> parameter is |
|
180 | - * determined solely by the client. |
|
181 | - * |
|
182 | - * @param string $message The new diagnostic context information. |
|
183 | - * @static |
|
184 | - */ |
|
185 | - public static function push($message) { |
|
186 | - array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message); |
|
187 | - } |
|
176 | + /** |
|
177 | + * Push new diagnostic context information for the current thread. |
|
178 | + * |
|
179 | + * <p>The contents of the <var>message</var> parameter is |
|
180 | + * determined solely by the client. |
|
181 | + * |
|
182 | + * @param string $message The new diagnostic context information. |
|
183 | + * @static |
|
184 | + */ |
|
185 | + public static function push($message) { |
|
186 | + array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message); |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Remove the diagnostic context for this thread. |
|
191 | - * @static |
|
192 | - */ |
|
193 | - public static function remove() { |
|
194 | - LoggerNDC::clear(); |
|
195 | - } |
|
189 | + /** |
|
190 | + * Remove the diagnostic context for this thread. |
|
191 | + * @static |
|
192 | + */ |
|
193 | + public static function remove() { |
|
194 | + LoggerNDC::clear(); |
|
195 | + } |
|
196 | 196 | |
197 | - /** |
|
198 | - * Set maximum depth of this diagnostic context. If the current |
|
199 | - * depth is smaller or equal to <var>maxDepth</var>, then no |
|
200 | - * action is taken. |
|
201 | - * |
|
202 | - * <p>This method is a convenient alternative to multiple |
|
203 | - * {@link pop()} calls. Moreover, it is often the case that at |
|
204 | - * the end of complex call sequences, the depth of the NDC is |
|
205 | - * unpredictable. The {@link setMaxDepth()} method circumvents |
|
206 | - * this problem. |
|
207 | - * |
|
208 | - * @param integer $maxDepth |
|
209 | - * @see getDepth() |
|
210 | - * @static |
|
211 | - */ |
|
212 | - public static function setMaxDepth($maxDepth) { |
|
213 | - $maxDepth = (int)$maxDepth; |
|
214 | - if($maxDepth <= self::HT_SIZE) { |
|
215 | - if(LoggerNDC::getDepth() > $maxDepth) { |
|
216 | - $GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth); |
|
217 | - } |
|
218 | - } |
|
219 | - } |
|
197 | + /** |
|
198 | + * Set maximum depth of this diagnostic context. If the current |
|
199 | + * depth is smaller or equal to <var>maxDepth</var>, then no |
|
200 | + * action is taken. |
|
201 | + * |
|
202 | + * <p>This method is a convenient alternative to multiple |
|
203 | + * {@link pop()} calls. Moreover, it is often the case that at |
|
204 | + * the end of complex call sequences, the depth of the NDC is |
|
205 | + * unpredictable. The {@link setMaxDepth()} method circumvents |
|
206 | + * this problem. |
|
207 | + * |
|
208 | + * @param integer $maxDepth |
|
209 | + * @see getDepth() |
|
210 | + * @static |
|
211 | + */ |
|
212 | + public static function setMaxDepth($maxDepth) { |
|
213 | + $maxDepth = (int)$maxDepth; |
|
214 | + if($maxDepth <= self::HT_SIZE) { |
|
215 | + if(LoggerNDC::getDepth() > $maxDepth) { |
|
216 | + $GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth); |
|
217 | + } |
|
218 | + } |
|
219 | + } |
|
220 | 220 | |
221 | 221 | } |