@@ -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 | * ConsoleAppender appends log events to STDOUT or STDERR. |
@@ -43,70 +43,70 @@ discard block |
||
43 | 43 | */ |
44 | 44 | class LoggerAppenderConsole extends LoggerAppender { |
45 | 45 | |
46 | - const STDOUT = 'php://stdout'; |
|
47 | - const STDERR = 'php://stderr'; |
|
46 | + const STDOUT = 'php://stdout'; |
|
47 | + const STDERR = 'php://stderr'; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). |
|
51 | - * Default is STDOUT |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - private $target = self::STDOUT; |
|
49 | + /** |
|
50 | + * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). |
|
51 | + * Default is STDOUT |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + private $target = self::STDOUT; |
|
55 | 55 | |
56 | - /** |
|
57 | - * @var boolean |
|
58 | - * @access private |
|
59 | - */ |
|
60 | - protected $requiresLayout = true; |
|
56 | + /** |
|
57 | + * @var boolean |
|
58 | + * @access private |
|
59 | + */ |
|
60 | + protected $requiresLayout = true; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @var mixed the resource used to open stdout/stderr |
|
64 | - * @access private |
|
65 | - */ |
|
66 | - protected $fp = null; |
|
62 | + /** |
|
63 | + * @var mixed the resource used to open stdout/stderr |
|
64 | + * @access private |
|
65 | + */ |
|
66 | + protected $fp = null; |
|
67 | 67 | |
68 | - public function __destruct() { |
|
69 | - $this->close(); |
|
70 | - } |
|
68 | + public function __destruct() { |
|
69 | + $this->close(); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Set console target. |
|
74 | - * @param mixed $value a constant or a string |
|
75 | - */ |
|
76 | - public function setTarget($value) { |
|
77 | - $v = trim($value); |
|
78 | - if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') { |
|
79 | - $this->target = self::STDOUT; |
|
80 | - } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') { |
|
81 | - $this->target = self::STDERR; |
|
82 | - } |
|
83 | - } |
|
72 | + /** |
|
73 | + * Set console target. |
|
74 | + * @param mixed $value a constant or a string |
|
75 | + */ |
|
76 | + public function setTarget($value) { |
|
77 | + $v = trim($value); |
|
78 | + if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') { |
|
79 | + $this->target = self::STDOUT; |
|
80 | + } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') { |
|
81 | + $this->target = self::STDERR; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | - public function activateOptions() { |
|
86 | - $this->fp = fopen($this->target, 'w'); |
|
87 | - if(is_resource($this->fp) && $this->layout !== null) { |
|
88 | - fwrite($this->fp, $this->layout->getHeader()); |
|
89 | - } |
|
90 | - $this->closed = (bool)is_resource($this->fp) === false; |
|
91 | - } |
|
85 | + public function activateOptions() { |
|
86 | + $this->fp = fopen($this->target, 'w'); |
|
87 | + if(is_resource($this->fp) && $this->layout !== null) { |
|
88 | + fwrite($this->fp, $this->layout->getHeader()); |
|
89 | + } |
|
90 | + $this->closed = (bool)is_resource($this->fp) === false; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * @see LoggerAppender::close() |
|
95 | - */ |
|
96 | - public function close() { |
|
97 | - if($this->closed != true) { |
|
98 | - if (is_resource($this->fp) && $this->layout !== null) { |
|
99 | - fwrite($this->fp, $this->layout->getFooter()); |
|
100 | - fclose($this->fp); |
|
101 | - } |
|
102 | - $this->closed = true; |
|
103 | - } |
|
104 | - } |
|
93 | + /** |
|
94 | + * @see LoggerAppender::close() |
|
95 | + */ |
|
96 | + public function close() { |
|
97 | + if($this->closed != true) { |
|
98 | + if (is_resource($this->fp) && $this->layout !== null) { |
|
99 | + fwrite($this->fp, $this->layout->getFooter()); |
|
100 | + fclose($this->fp); |
|
101 | + } |
|
102 | + $this->closed = true; |
|
103 | + } |
|
104 | + } |
|
105 | 105 | |
106 | - public function append(LoggerLoggingEvent $event) { |
|
107 | - if (is_resource($this->fp) && $this->layout !== null) { |
|
108 | - fwrite($this->fp, $this->layout->format($event)); |
|
109 | - } |
|
110 | - } |
|
106 | + public function append(LoggerLoggingEvent $event) { |
|
107 | + if (is_resource($this->fp) && $this->layout !== null) { |
|
108 | + fwrite($this->fp, $this->layout->format($event)); |
|
109 | + } |
|
110 | + } |
|
111 | 111 | } |
112 | 112 |
@@ -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 | * FileAppender appends log events to a file. |
@@ -42,129 +42,129 @@ discard block |
||
42 | 42 | */ |
43 | 43 | class LoggerAppenderFile extends LoggerAppender { |
44 | 44 | |
45 | - /** |
|
46 | - * @var boolean if {@link $file} exists, appends events. |
|
47 | - */ |
|
48 | - private $append = true; |
|
49 | - /** |
|
50 | - * @var string the file name used to append events |
|
51 | - */ |
|
52 | - protected $fileName; |
|
53 | - /** |
|
54 | - * @var mixed file resource |
|
55 | - */ |
|
56 | - protected $fp = false; |
|
45 | + /** |
|
46 | + * @var boolean if {@link $file} exists, appends events. |
|
47 | + */ |
|
48 | + private $append = true; |
|
49 | + /** |
|
50 | + * @var string the file name used to append events |
|
51 | + */ |
|
52 | + protected $fileName; |
|
53 | + /** |
|
54 | + * @var mixed file resource |
|
55 | + */ |
|
56 | + protected $fp = false; |
|
57 | 57 | |
58 | - public function __construct($name = '') { |
|
59 | - parent::__construct($name); |
|
60 | - $this->requiresLayout = true; |
|
61 | - } |
|
58 | + public function __construct($name = '') { |
|
59 | + parent::__construct($name); |
|
60 | + $this->requiresLayout = true; |
|
61 | + } |
|
62 | 62 | |
63 | - public function __destruct() { |
|
64 | - $this->close(); |
|
65 | - } |
|
63 | + public function __destruct() { |
|
64 | + $this->close(); |
|
65 | + } |
|
66 | 66 | |
67 | - public function activateOptions() { |
|
68 | - $fileName = $this->getFile(); |
|
67 | + public function activateOptions() { |
|
68 | + $fileName = $this->getFile(); |
|
69 | 69 | |
70 | - if(!is_file($fileName)) { |
|
71 | - $dir = dirname($fileName); |
|
72 | - if(!is_dir($dir)) { |
|
73 | - mkdir($dir, 0777, true); |
|
74 | - } |
|
75 | - } |
|
70 | + if(!is_file($fileName)) { |
|
71 | + $dir = dirname($fileName); |
|
72 | + if(!is_dir($dir)) { |
|
73 | + mkdir($dir, 0777, true); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
78 | - if($this->fp) { |
|
79 | - if(flock($this->fp, LOCK_EX)) { |
|
80 | - if($this->getAppend()) { |
|
81 | - fseek($this->fp, 0, SEEK_END); |
|
82 | - } |
|
83 | - fwrite($this->fp, $this->layout->getHeader()); |
|
84 | - flock($this->fp, LOCK_UN); |
|
85 | - $this->closed = false; |
|
86 | - } else { |
|
87 | - // TODO: should we take some action in this case? |
|
88 | - $this->closed = true; |
|
89 | - } |
|
90 | - } else { |
|
91 | - $this->closed = true; |
|
92 | - } |
|
93 | - } |
|
77 | + $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
78 | + if($this->fp) { |
|
79 | + if(flock($this->fp, LOCK_EX)) { |
|
80 | + if($this->getAppend()) { |
|
81 | + fseek($this->fp, 0, SEEK_END); |
|
82 | + } |
|
83 | + fwrite($this->fp, $this->layout->getHeader()); |
|
84 | + flock($this->fp, LOCK_UN); |
|
85 | + $this->closed = false; |
|
86 | + } else { |
|
87 | + // TODO: should we take some action in this case? |
|
88 | + $this->closed = true; |
|
89 | + } |
|
90 | + } else { |
|
91 | + $this->closed = true; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - public function close() { |
|
96 | - if($this->closed != true) { |
|
97 | - if($this->fp and $this->layout !== null) { |
|
98 | - if(flock($this->fp, LOCK_EX)) { |
|
99 | - fwrite($this->fp, $this->layout->getFooter()); |
|
100 | - flock($this->fp, LOCK_UN); |
|
101 | - } |
|
102 | - fclose($this->fp); |
|
103 | - } |
|
104 | - $this->closed = true; |
|
105 | - } |
|
106 | - } |
|
95 | + public function close() { |
|
96 | + if($this->closed != true) { |
|
97 | + if($this->fp and $this->layout !== null) { |
|
98 | + if(flock($this->fp, LOCK_EX)) { |
|
99 | + fwrite($this->fp, $this->layout->getFooter()); |
|
100 | + flock($this->fp, LOCK_UN); |
|
101 | + } |
|
102 | + fclose($this->fp); |
|
103 | + } |
|
104 | + $this->closed = true; |
|
105 | + } |
|
106 | + } |
|
107 | 107 | |
108 | - public function append(LoggerLoggingEvent $event) { |
|
109 | - if($this->fp and $this->layout !== null) { |
|
110 | - if(flock($this->fp, LOCK_EX)) { |
|
111 | - fwrite($this->fp, $this->layout->format($event)); |
|
112 | - flock($this->fp, LOCK_UN); |
|
113 | - } else { |
|
114 | - $this->closed = true; |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
108 | + public function append(LoggerLoggingEvent $event) { |
|
109 | + if($this->fp and $this->layout !== null) { |
|
110 | + if(flock($this->fp, LOCK_EX)) { |
|
111 | + fwrite($this->fp, $this->layout->format($event)); |
|
112 | + flock($this->fp, LOCK_UN); |
|
113 | + } else { |
|
114 | + $this->closed = true; |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Sets and opens the file where the log output will go. |
|
121 | - * |
|
122 | - * This is an overloaded method. It can be called with: |
|
123 | - * - setFile(string $fileName) to set filename. |
|
124 | - * - setFile(string $fileName, boolean $append) to set filename and append. |
|
125 | - * |
|
126 | - * TODO: remove overloading. Use only file as alias to filename |
|
127 | - */ |
|
128 | - public function setFile() { |
|
129 | - $numargs = func_num_args(); |
|
130 | - $args = func_get_args(); |
|
119 | + /** |
|
120 | + * Sets and opens the file where the log output will go. |
|
121 | + * |
|
122 | + * This is an overloaded method. It can be called with: |
|
123 | + * - setFile(string $fileName) to set filename. |
|
124 | + * - setFile(string $fileName, boolean $append) to set filename and append. |
|
125 | + * |
|
126 | + * TODO: remove overloading. Use only file as alias to filename |
|
127 | + */ |
|
128 | + public function setFile() { |
|
129 | + $numargs = func_num_args(); |
|
130 | + $args = func_get_args(); |
|
131 | 131 | |
132 | - if($numargs == 1 and is_string($args[0])) { |
|
133 | - $this->setFileName($args[0]); |
|
134 | - } else if ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) { |
|
135 | - $this->setFile($args[0]); |
|
136 | - $this->setAppend($args[1]); |
|
137 | - } |
|
138 | - } |
|
132 | + if($numargs == 1 and is_string($args[0])) { |
|
133 | + $this->setFileName($args[0]); |
|
134 | + } else if ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) { |
|
135 | + $this->setFile($args[0]); |
|
136 | + $this->setAppend($args[1]); |
|
137 | + } |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public function getFile() { |
|
144 | - return $this->getFileName(); |
|
145 | - } |
|
140 | + /** |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public function getFile() { |
|
144 | + return $this->getFileName(); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * @return boolean |
|
149 | - */ |
|
150 | - public function getAppend() { |
|
151 | - return $this->append; |
|
152 | - } |
|
147 | + /** |
|
148 | + * @return boolean |
|
149 | + */ |
|
150 | + public function getAppend() { |
|
151 | + return $this->append; |
|
152 | + } |
|
153 | 153 | |
154 | - public function setAppend($flag) { |
|
155 | - $this->append = LoggerOptionConverter::toBoolean($flag, true); |
|
156 | - } |
|
154 | + public function setAppend($flag) { |
|
155 | + $this->append = LoggerOptionConverter::toBoolean($flag, true); |
|
156 | + } |
|
157 | 157 | |
158 | - public function setFileName($fileName) { |
|
159 | - $this->fileName = $fileName; |
|
160 | - } |
|
158 | + public function setFileName($fileName) { |
|
159 | + $this->fileName = $fileName; |
|
160 | + } |
|
161 | 161 | |
162 | - /** |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function getFileName() { |
|
166 | - return $this->fileName; |
|
167 | - } |
|
162 | + /** |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function getFileName() { |
|
166 | + return $this->fileName; |
|
167 | + } |
|
168 | 168 | |
169 | 169 | |
170 | 170 | } |
@@ -41,40 +41,40 @@ |
||
41 | 41 | * @subpackage appenders |
42 | 42 | */ |
43 | 43 | class LoggerAppenderEcho extends LoggerAppender { |
44 | - /** boolean used internally to mark first append */ |
|
45 | - private $firstAppend = true; |
|
44 | + /** boolean used internally to mark first append */ |
|
45 | + private $firstAppend = true; |
|
46 | 46 | |
47 | - public function __construct($name = '') { |
|
48 | - parent::__construct($name); |
|
49 | - $this->requiresLayout = true; |
|
50 | - $this->firstAppend = true; |
|
51 | - } |
|
47 | + public function __construct($name = '') { |
|
48 | + parent::__construct($name); |
|
49 | + $this->requiresLayout = true; |
|
50 | + $this->firstAppend = true; |
|
51 | + } |
|
52 | 52 | |
53 | - public function __destruct() { |
|
54 | - $this->close(); |
|
55 | - } |
|
53 | + public function __destruct() { |
|
54 | + $this->close(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function activateOptions() { |
|
58 | - $this->closed = false; |
|
59 | - } |
|
57 | + public function activateOptions() { |
|
58 | + $this->closed = false; |
|
59 | + } |
|
60 | 60 | |
61 | - public function close() { |
|
62 | - if($this->closed != true) { |
|
63 | - if(!$this->firstAppend) { |
|
64 | - echo $this->layout->getFooter(); |
|
65 | - } |
|
66 | - } |
|
67 | - $this->closed = true; |
|
68 | - } |
|
61 | + public function close() { |
|
62 | + if($this->closed != true) { |
|
63 | + if(!$this->firstAppend) { |
|
64 | + echo $this->layout->getFooter(); |
|
65 | + } |
|
66 | + } |
|
67 | + $this->closed = true; |
|
68 | + } |
|
69 | 69 | |
70 | - public function append(LoggerLoggingEvent $event) { |
|
71 | - if($this->layout !== null) { |
|
72 | - if($this->firstAppend) { |
|
73 | - echo $this->layout->getHeader(); |
|
74 | - $this->firstAppend = false; |
|
75 | - } |
|
76 | - echo $this->layout->format($event); |
|
77 | - } |
|
78 | - } |
|
70 | + public function append(LoggerLoggingEvent $event) { |
|
71 | + if($this->layout !== null) { |
|
72 | + if($this->firstAppend) { |
|
73 | + echo $this->layout->getHeader(); |
|
74 | + $this->firstAppend = false; |
|
75 | + } |
|
76 | + echo $this->layout->format($event); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | } |
80 | 80 |
@@ -40,33 +40,33 @@ |
||
40 | 40 | */ |
41 | 41 | class LoggerAppenderPhp extends LoggerAppender { |
42 | 42 | |
43 | - public function __construct($name = '') { |
|
44 | - parent::__construct($name); |
|
45 | - $this->requiresLayout = true; |
|
46 | - } |
|
43 | + public function __construct($name = '') { |
|
44 | + parent::__construct($name); |
|
45 | + $this->requiresLayout = true; |
|
46 | + } |
|
47 | 47 | |
48 | - public function __destruct() { |
|
49 | - $this->close(); |
|
50 | - } |
|
48 | + public function __destruct() { |
|
49 | + $this->close(); |
|
50 | + } |
|
51 | 51 | |
52 | - public function activateOptions() { |
|
53 | - $this->closed = false; |
|
54 | - } |
|
52 | + public function activateOptions() { |
|
53 | + $this->closed = false; |
|
54 | + } |
|
55 | 55 | |
56 | - public function close() { |
|
57 | - $this->closed = true; |
|
58 | - } |
|
56 | + public function close() { |
|
57 | + $this->closed = true; |
|
58 | + } |
|
59 | 59 | |
60 | - public function append(LoggerLoggingEvent $event) { |
|
61 | - if($this->layout !== null) { |
|
62 | - $level = $event->getLevel(); |
|
63 | - if($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
64 | - trigger_error($this->layout->format($event), E_USER_ERROR); |
|
65 | - } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
66 | - trigger_error($this->layout->format($event), E_USER_WARNING); |
|
67 | - } else { |
|
68 | - trigger_error($this->layout->format($event), E_USER_NOTICE); |
|
69 | - } |
|
70 | - } |
|
71 | - } |
|
60 | + public function append(LoggerLoggingEvent $event) { |
|
61 | + if($this->layout !== null) { |
|
62 | + $level = $event->getLevel(); |
|
63 | + if($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
64 | + trigger_error($this->layout->format($event), E_USER_ERROR); |
|
65 | + } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
66 | + trigger_error($this->layout->format($event), E_USER_WARNING); |
|
67 | + } else { |
|
68 | + trigger_error($this->layout->format($event), E_USER_NOTICE); |
|
69 | + } |
|
70 | + } |
|
71 | + } |
|
72 | 72 | } |
@@ -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 |
@@ -46,215 +46,215 @@ |
||
46 | 46 | */ |
47 | 47 | class LoggerAppenderSocket extends LoggerAppender { |
48 | 48 | |
49 | - /** |
|
50 | - * @var mixed socket connection resource |
|
51 | - * @access private |
|
52 | - */ |
|
53 | - private $sp = false; |
|
49 | + /** |
|
50 | + * @var mixed socket connection resource |
|
51 | + * @access private |
|
52 | + */ |
|
53 | + private $sp = false; |
|
54 | 54 | |
55 | - /** |
|
56 | - * Target host. On how to define remote hostaname see |
|
57 | - * {@link PHP_MANUAL#fsockopen} |
|
58 | - * @var string |
|
59 | - */ |
|
60 | - private $remoteHost = ''; |
|
55 | + /** |
|
56 | + * Target host. On how to define remote hostaname see |
|
57 | + * {@link PHP_MANUAL#fsockopen} |
|
58 | + * @var string |
|
59 | + */ |
|
60 | + private $remoteHost = ''; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @var integer the network port. |
|
64 | - */ |
|
65 | - private $port = 4446; |
|
62 | + /** |
|
63 | + * @var integer the network port. |
|
64 | + */ |
|
65 | + private $port = 4446; |
|
66 | 66 | |
67 | - /** |
|
68 | - * @var boolean get event's location info. |
|
69 | - */ |
|
70 | - private $locationInfo = false; |
|
67 | + /** |
|
68 | + * @var boolean get event's location info. |
|
69 | + */ |
|
70 | + private $locationInfo = false; |
|
71 | 71 | |
72 | - /** |
|
73 | - * @var integer connection timeout |
|
74 | - */ |
|
75 | - private $timeout = 30; |
|
72 | + /** |
|
73 | + * @var integer connection timeout |
|
74 | + */ |
|
75 | + private $timeout = 30; |
|
76 | 76 | |
77 | - /** |
|
78 | - * @var boolean output events via {@link LoggerXmlLayout} |
|
79 | - */ |
|
80 | - private $useXml = false; |
|
77 | + /** |
|
78 | + * @var boolean output events via {@link LoggerXmlLayout} |
|
79 | + */ |
|
80 | + private $useXml = false; |
|
81 | 81 | |
82 | - /** |
|
83 | - * @var boolean forward this option to {@link LoggerXmlLayout}. |
|
84 | - * Ignored if {@link $useXml} is <i>false</i>. |
|
85 | - */ |
|
86 | - private $log4jNamespace = false; |
|
82 | + /** |
|
83 | + * @var boolean forward this option to {@link LoggerXmlLayout}. |
|
84 | + * Ignored if {@link $useXml} is <i>false</i>. |
|
85 | + */ |
|
86 | + private $log4jNamespace = false; |
|
87 | 87 | |
88 | - /** |
|
89 | - * @var LoggerXmlLayout |
|
90 | - * @access private |
|
91 | - */ |
|
92 | - private $xmlLayout = null; |
|
88 | + /** |
|
89 | + * @var LoggerXmlLayout |
|
90 | + * @access private |
|
91 | + */ |
|
92 | + private $xmlLayout = null; |
|
93 | 93 | |
94 | - /** @var indiciates if this appender should run in dry mode */ |
|
95 | - private $dry = false; |
|
94 | + /** @var indiciates if this appender should run in dry mode */ |
|
95 | + private $dry = false; |
|
96 | 96 | |
97 | - public function __destruct() { |
|
98 | - $this->close(); |
|
99 | - } |
|
97 | + public function __destruct() { |
|
98 | + $this->close(); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Create a socket connection using defined parameters |
|
103 | - */ |
|
104 | - public function activateOptions() { |
|
105 | - if(!$this->dry) { |
|
106 | - $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout()); |
|
107 | - if ($this->sp === false) { |
|
108 | - throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)"); |
|
109 | - } |
|
110 | - } |
|
111 | - if($this->getUseXml()) { |
|
112 | - $this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml'); |
|
113 | - if($this->xmlLayout === null) { |
|
114 | - $this->setUseXml(false); |
|
115 | - } else { |
|
116 | - $this->xmlLayout->setLocationInfo($this->getLocationInfo()); |
|
117 | - $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace()); |
|
118 | - $this->xmlLayout->activateOptions(); |
|
119 | - } |
|
120 | - } |
|
101 | + /** |
|
102 | + * Create a socket connection using defined parameters |
|
103 | + */ |
|
104 | + public function activateOptions() { |
|
105 | + if(!$this->dry) { |
|
106 | + $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout()); |
|
107 | + if ($this->sp === false) { |
|
108 | + throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)"); |
|
109 | + } |
|
110 | + } |
|
111 | + if($this->getUseXml()) { |
|
112 | + $this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml'); |
|
113 | + if($this->xmlLayout === null) { |
|
114 | + $this->setUseXml(false); |
|
115 | + } else { |
|
116 | + $this->xmlLayout->setLocationInfo($this->getLocationInfo()); |
|
117 | + $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace()); |
|
118 | + $this->xmlLayout->activateOptions(); |
|
119 | + } |
|
120 | + } |
|
121 | 121 | $this->closed = false; |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - public function close() { |
|
125 | - if($this->closed != true) { |
|
126 | - if(!$this->dry and $this->sp !== false) { |
|
127 | - fclose($this->sp); |
|
128 | - } |
|
129 | - $this->closed = true; |
|
130 | - } |
|
131 | - } |
|
124 | + public function close() { |
|
125 | + if($this->closed != true) { |
|
126 | + if(!$this->dry and $this->sp !== false) { |
|
127 | + fclose($this->sp); |
|
128 | + } |
|
129 | + $this->closed = true; |
|
130 | + } |
|
131 | + } |
|
132 | 132 | |
133 | - public function setDry($dry) { |
|
134 | - $this->dry = $dry; |
|
135 | - } |
|
133 | + public function setDry($dry) { |
|
134 | + $this->dry = $dry; |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * @return string |
|
139 | - */ |
|
140 | - public function getHostname() { |
|
141 | - return $this->getRemoteHost(); |
|
142 | - } |
|
137 | + /** |
|
138 | + * @return string |
|
139 | + */ |
|
140 | + public function getHostname() { |
|
141 | + return $this->getRemoteHost(); |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * @return boolean |
|
146 | - */ |
|
147 | - public function getLocationInfo() { |
|
148 | - return $this->locationInfo; |
|
149 | - } |
|
144 | + /** |
|
145 | + * @return boolean |
|
146 | + */ |
|
147 | + public function getLocationInfo() { |
|
148 | + return $this->locationInfo; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * @return boolean |
|
153 | - */ |
|
154 | - public function getLog4jNamespace() { |
|
155 | - return $this->log4jNamespace; |
|
156 | - } |
|
151 | + /** |
|
152 | + * @return boolean |
|
153 | + */ |
|
154 | + public function getLog4jNamespace() { |
|
155 | + return $this->log4jNamespace; |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * @return integer |
|
160 | - */ |
|
161 | - public function getPort() { |
|
162 | - return $this->port; |
|
163 | - } |
|
158 | + /** |
|
159 | + * @return integer |
|
160 | + */ |
|
161 | + public function getPort() { |
|
162 | + return $this->port; |
|
163 | + } |
|
164 | 164 | |
165 | - public function getRemoteHost() { |
|
166 | - return $this->remoteHost; |
|
167 | - } |
|
165 | + public function getRemoteHost() { |
|
166 | + return $this->remoteHost; |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * @return integer |
|
171 | - */ |
|
172 | - public function getTimeout() { |
|
173 | - return $this->timeout; |
|
174 | - } |
|
169 | + /** |
|
170 | + * @return integer |
|
171 | + */ |
|
172 | + public function getTimeout() { |
|
173 | + return $this->timeout; |
|
174 | + } |
|
175 | 175 | |
176 | - /** |
|
177 | - * @var boolean |
|
178 | - */ |
|
179 | - public function getUseXml() { |
|
180 | - return $this->useXml; |
|
181 | - } |
|
176 | + /** |
|
177 | + * @var boolean |
|
178 | + */ |
|
179 | + public function getUseXml() { |
|
180 | + return $this->useXml; |
|
181 | + } |
|
182 | 182 | |
183 | - public function reset() { |
|
184 | - $this->close(); |
|
185 | - parent::reset(); |
|
186 | - } |
|
183 | + public function reset() { |
|
184 | + $this->close(); |
|
185 | + parent::reset(); |
|
186 | + } |
|
187 | 187 | |
188 | - /** |
|
189 | - * @param mixed |
|
190 | - */ |
|
191 | - public function setLocationInfo($flag) { |
|
192 | - $this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo()); |
|
193 | - } |
|
188 | + /** |
|
189 | + * @param mixed |
|
190 | + */ |
|
191 | + public function setLocationInfo($flag) { |
|
192 | + $this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo()); |
|
193 | + } |
|
194 | 194 | |
195 | - /** |
|
196 | - * @param mixed |
|
197 | - */ |
|
198 | - public function setLog4jNamespace($flag) { |
|
199 | - $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace()); |
|
200 | - } |
|
195 | + /** |
|
196 | + * @param mixed |
|
197 | + */ |
|
198 | + public function setLog4jNamespace($flag) { |
|
199 | + $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace()); |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
203 | - * @param integer |
|
204 | - */ |
|
205 | - public function setPort($port) { |
|
206 | - $port = LoggerOptionConverter::toInt($port, 0); |
|
207 | - if($port > 0 and $port < 65535) { |
|
208 | - $this->port = $port; |
|
209 | - } |
|
210 | - } |
|
202 | + /** |
|
203 | + * @param integer |
|
204 | + */ |
|
205 | + public function setPort($port) { |
|
206 | + $port = LoggerOptionConverter::toInt($port, 0); |
|
207 | + if($port > 0 and $port < 65535) { |
|
208 | + $this->port = $port; |
|
209 | + } |
|
210 | + } |
|
211 | 211 | |
212 | - /** |
|
213 | - * @param string |
|
214 | - */ |
|
215 | - public function setRemoteHost($hostname) { |
|
216 | - $this->remoteHost = $hostname; |
|
217 | - } |
|
212 | + /** |
|
213 | + * @param string |
|
214 | + */ |
|
215 | + public function setRemoteHost($hostname) { |
|
216 | + $this->remoteHost = $hostname; |
|
217 | + } |
|
218 | 218 | |
219 | - /** |
|
220 | - * @param integer |
|
221 | - */ |
|
222 | - public function setTimeout($timeout) { |
|
223 | - $this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout()); |
|
224 | - } |
|
219 | + /** |
|
220 | + * @param integer |
|
221 | + */ |
|
222 | + public function setTimeout($timeout) { |
|
223 | + $this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout()); |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * @param mixed |
|
228 | - */ |
|
229 | - public function setUseXml($flag) { |
|
230 | - $this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml()); |
|
231 | - } |
|
226 | + /** |
|
227 | + * @param mixed |
|
228 | + */ |
|
229 | + public function setUseXml($flag) { |
|
230 | + $this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml()); |
|
231 | + } |
|
232 | 232 | |
233 | - public function append(LoggerLoggingEvent $event) { |
|
234 | - if($this->sp || $this->dry) { |
|
235 | - if($this->getLocationInfo()) { |
|
236 | - $event->getLocationInformation(); |
|
237 | - } |
|
233 | + public function append(LoggerLoggingEvent $event) { |
|
234 | + if($this->sp || $this->dry) { |
|
235 | + if($this->getLocationInfo()) { |
|
236 | + $event->getLocationInformation(); |
|
237 | + } |
|
238 | 238 | |
239 | - if(!$this->getUseXml()) { |
|
240 | - $sEvent = serialize($event); |
|
241 | - if(!$this->dry) { |
|
242 | - fwrite($this->sp, $sEvent, strlen($sEvent)); |
|
243 | - } else { |
|
244 | - echo "DRY MODE OF SOCKET APPENDER: ".$sEvent; |
|
245 | - } |
|
246 | - } else { |
|
247 | - if(!$this->dry) { |
|
248 | - fwrite($this->sp, $this->xmlLayout->format($event)); |
|
249 | - } else { |
|
250 | - echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event); |
|
251 | - } |
|
252 | - } |
|
239 | + if(!$this->getUseXml()) { |
|
240 | + $sEvent = serialize($event); |
|
241 | + if(!$this->dry) { |
|
242 | + fwrite($this->sp, $sEvent, strlen($sEvent)); |
|
243 | + } else { |
|
244 | + echo "DRY MODE OF SOCKET APPENDER: ".$sEvent; |
|
245 | + } |
|
246 | + } else { |
|
247 | + if(!$this->dry) { |
|
248 | + fwrite($this->sp, $this->xmlLayout->format($event)); |
|
249 | + } else { |
|
250 | + echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event); |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | - // not sure about it... |
|
255 | - if(!$this->dry) { |
|
256 | - fflush($this->sp); |
|
257 | - } |
|
258 | - } |
|
259 | - } |
|
254 | + // not sure about it... |
|
255 | + if(!$this->dry) { |
|
256 | + fflush($this->sp); |
|
257 | + } |
|
258 | + } |
|
259 | + } |
|
260 | 260 | } |
@@ -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 | * Implemented by classes capable of configuring log4php using a URL. |
@@ -26,28 +26,28 @@ discard block |
||
26 | 26 | */ |
27 | 27 | interface LoggerConfigurator { |
28 | 28 | |
29 | - /** |
|
30 | - * Special level value signifying inherited behaviour. The current |
|
31 | - * value of this string constant is <b>inherited</b>. |
|
32 | - * {@link CONFIGURATOR_NULL} is a synonym. |
|
33 | - */ |
|
34 | - const CONFIGURATOR_INHERITED = 'inherited'; |
|
29 | + /** |
|
30 | + * Special level value signifying inherited behaviour. The current |
|
31 | + * value of this string constant is <b>inherited</b>. |
|
32 | + * {@link CONFIGURATOR_NULL} is a synonym. |
|
33 | + */ |
|
34 | + const CONFIGURATOR_INHERITED = 'inherited'; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Special level signifying inherited behaviour, same as |
|
38 | - * {@link CONFIGURATOR_INHERITED}. |
|
39 | - * The current value of this string constant is <b>null</b>. |
|
40 | - */ |
|
41 | - const CONFIGURATOR_NULL = 'null'; |
|
36 | + /** |
|
37 | + * Special level signifying inherited behaviour, same as |
|
38 | + * {@link CONFIGURATOR_INHERITED}. |
|
39 | + * The current value of this string constant is <b>null</b>. |
|
40 | + */ |
|
41 | + const CONFIGURATOR_NULL = 'null'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Interpret a resource pointed by a <var>url</var> and configure accordingly. |
|
45 | - * |
|
46 | - * The configuration is done relative to the <var>repository</var> |
|
47 | - * parameter. |
|
48 | - * |
|
49 | - * @param string $url The URL to parse |
|
50 | - */ |
|
51 | - public function configure(LoggerHierarchy $hierarchy, $url = null); |
|
43 | + /** |
|
44 | + * Interpret a resource pointed by a <var>url</var> and configure accordingly. |
|
45 | + * |
|
46 | + * The configuration is done relative to the <var>repository</var> |
|
47 | + * parameter. |
|
48 | + * |
|
49 | + * @param string $url The URL to parse |
|
50 | + */ |
|
51 | + public function configure(LoggerHierarchy $hierarchy, $url = null); |
|
52 | 52 | |
53 | 53 | } |
@@ -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 | } |