Completed
Push — developer ( 9c89f4...5b19f1 )
by Błażej
155:55 queued 109:20
created
libraries/log4php.debug/helpers/LoggerOptionConverter.php 1 patch
Indentation   +283 added lines, -283 removed lines patch added patch discarded remove patch
@@ -41,310 +41,310 @@
 block discarded – undo
41 41
  */
42 42
 class LoggerOptionConverter {
43 43
 
44
-    /** 
45
-     * OptionConverter is a static class. 
46
-     */
47
-    public function OptionConverter() 
48
-    {
49
-        return;
50
-    }
44
+	/** 
45
+	 * OptionConverter is a static class. 
46
+	 */
47
+	public function OptionConverter() 
48
+	{
49
+		return;
50
+	}
51 51
 
52
-    /**
53
-     * @param array $l
54
-     * @param array $r
55
-     * @return array
56
-     *
57
-     * @static
58
-     */
59
-    public function concatanateArrays($l, $r)
60
-    {
61
-        return array_merge($l, $r);
62
-    }
52
+	/**
53
+	 * @param array $l
54
+	 * @param array $r
55
+	 * @return array
56
+	 *
57
+	 * @static
58
+	 */
59
+	public function concatanateArrays($l, $r)
60
+	{
61
+		return array_merge($l, $r);
62
+	}
63 63
 
64
-    /**
65
-    * Read a predefined var.
66
-    *
67
-    * It returns a value referenced by <var>$key</var> using this search criteria:
68
-    * - if <var>$key</var> is a constant then return it. Else
69
-    * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
70
-    * - return <var>$def</var>. 
71
-    *
72
-    * @param string $key The key to search for.
73
-    * @param string $def The default value to return.
74
-    * @return string    the string value of the system property, or the default
75
-    *                   value if there is no property with that key.
76
-    *
77
-    * @static
78
-    */
79
-    public function getSystemProperty($key, $def)
80
-    {
81
-        LoggerLog::debug("LoggerOptionConverter::getSystemProperty():key=[{$key}]:def=[{$def}].");
64
+	/**
65
+	 * Read a predefined var.
66
+	 *
67
+	 * It returns a value referenced by <var>$key</var> using this search criteria:
68
+	 * - if <var>$key</var> is a constant then return it. Else
69
+	 * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
70
+	 * - return <var>$def</var>. 
71
+	 *
72
+	 * @param string $key The key to search for.
73
+	 * @param string $def The default value to return.
74
+	 * @return string    the string value of the system property, or the default
75
+	 *                   value if there is no property with that key.
76
+	 *
77
+	 * @static
78
+	 */
79
+	public function getSystemProperty($key, $def)
80
+	{
81
+		LoggerLog::debug("LoggerOptionConverter::getSystemProperty():key=[{$key}]:def=[{$def}].");
82 82
 
83
-        if (defined($key)) {
84
-            return (string)constant($key);
85
-        } elseif (isset($_ENV[$key])) {
86
-            return (string)$_ENV[$key];
87
-        } else {
88
-            return $def;
89
-        }
90
-    }
83
+		if (defined($key)) {
84
+			return (string)constant($key);
85
+		} elseif (isset($_ENV[$key])) {
86
+			return (string)$_ENV[$key];
87
+		} else {
88
+			return $def;
89
+		}
90
+	}
91 91
 
92
-    /**
93
-     * If <var>$value</var> is <i>true</i>, then <i>true</i> is
94
-     * returned. If <var>$value</var> is <i>false</i>, then
95
-     * <i>true</i> is returned. Otherwise, <var>$default</var> is
96
-     * returned.
97
-     *
98
-     * <p>Case of value is unimportant.</p>
99
-     *
100
-     * @param string $value
101
-     * @param boolean $default
102
-     * @return boolean
103
-     *
104
-     * @static
105
-     */
106
-    public function toBoolean($value, $default)
107
-    {
108
-        if($value === null)
109
-            return $default;
110
-        if ($value == 1)
111
-            return true;
112
-        $trimmedVal = strtolower(trim($value));
113
-        if ("true" == $trimmedVal || "yes" == $trimmedVal)
114
-            return true;
115
-        if ("false" == $trimmedVal)
116
-            return false;
117
-        return $default;
118
-    }
92
+	/**
93
+	 * If <var>$value</var> is <i>true</i>, then <i>true</i> is
94
+	 * returned. If <var>$value</var> is <i>false</i>, then
95
+	 * <i>true</i> is returned. Otherwise, <var>$default</var> is
96
+	 * returned.
97
+	 *
98
+	 * <p>Case of value is unimportant.</p>
99
+	 *
100
+	 * @param string $value
101
+	 * @param boolean $default
102
+	 * @return boolean
103
+	 *
104
+	 * @static
105
+	 */
106
+	public function toBoolean($value, $default)
107
+	{
108
+		if($value === null)
109
+			return $default;
110
+		if ($value == 1)
111
+			return true;
112
+		$trimmedVal = strtolower(trim($value));
113
+		if ("true" == $trimmedVal || "yes" == $trimmedVal)
114
+			return true;
115
+		if ("false" == $trimmedVal)
116
+			return false;
117
+		return $default;
118
+	}
119 119
 
120
-    /**
121
-     * @param string $value
122
-     * @param integer $default
123
-     * @return integer
124
-     * @static
125
-     */
126
-    public function toInt($value, $default)
127
-    {
128
-        $value = trim($value);
129
-        if (is_numeric($value)) {
130
-            return (int)$value;
131
-        } else {
132
-            return $default;
133
-        }
134
-    }
120
+	/**
121
+	 * @param string $value
122
+	 * @param integer $default
123
+	 * @return integer
124
+	 * @static
125
+	 */
126
+	public function toInt($value, $default)
127
+	{
128
+		$value = trim($value);
129
+		if (is_numeric($value)) {
130
+			return (int)$value;
131
+		} else {
132
+			return $default;
133
+		}
134
+	}
135 135
 
136
-    /**
137
-     * Converts a standard or custom priority level to a Level
138
-     * object.
139
-     *
140
-     * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
141
-     * where <i>full_file_classname</i> means the class filename with path
142
-     * but without php extension, then the specified class' <i>toLevel()</i> method
143
-     * is called to process the specified level string; if no '#'
144
-     * character is present, then the default {@link LoggerLevel}
145
-     * class is used to process the level value.</p>
146
-     *
147
-     * <p>As a special case, if the <var>$value</var> parameter is
148
-     * equal to the string "NULL", then the value <i>null</i> will
149
-     * be returned.</p>
150
-     *
151
-     * <p>If any error occurs while converting the value to a level,
152
-     * the <var>$defaultValue</var> parameter, which may be
153
-     * <i>null</i>, is returned.</p>
154
-     *
155
-     * <p>Case of <var>$value</var> is insignificant for the level level, but is
156
-     * significant for the class name part, if present.</p>
157
-     *
158
-     * @param string $value
159
-     * @param LoggerLevel $defaultValue
160
-     * @return LoggerLevel a {@link LoggerLevel} or null
161
-     * @static
162
-     */
163
-    public function toLevel($value, $defaultValue)
164
-    {
165
-        if($value === null)
166
-            return $defaultValue;
136
+	/**
137
+	 * Converts a standard or custom priority level to a Level
138
+	 * object.
139
+	 *
140
+	 * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
141
+	 * where <i>full_file_classname</i> means the class filename with path
142
+	 * but without php extension, then the specified class' <i>toLevel()</i> method
143
+	 * is called to process the specified level string; if no '#'
144
+	 * character is present, then the default {@link LoggerLevel}
145
+	 * class is used to process the level value.</p>
146
+	 *
147
+	 * <p>As a special case, if the <var>$value</var> parameter is
148
+	 * equal to the string "NULL", then the value <i>null</i> will
149
+	 * be returned.</p>
150
+	 *
151
+	 * <p>If any error occurs while converting the value to a level,
152
+	 * the <var>$defaultValue</var> parameter, which may be
153
+	 * <i>null</i>, is returned.</p>
154
+	 *
155
+	 * <p>Case of <var>$value</var> is insignificant for the level level, but is
156
+	 * significant for the class name part, if present.</p>
157
+	 *
158
+	 * @param string $value
159
+	 * @param LoggerLevel $defaultValue
160
+	 * @return LoggerLevel a {@link LoggerLevel} or null
161
+	 * @static
162
+	 */
163
+	public function toLevel($value, $defaultValue)
164
+	{
165
+		if($value === null)
166
+			return $defaultValue;
167 167
 
168
-        $hashIndex = strpos($value, '#');
169
-        if ($hashIndex === false) {
170
-            if("NULL" == strtoupper($value)) {
171
-	            return null;
172
-            } else {
173
-	            // no class name specified : use standard Level class
174
-	            return LoggerLevel::toLevel($value, $defaultValue);
175
-            }
176
-        }
168
+		$hashIndex = strpos($value, '#');
169
+		if ($hashIndex === false) {
170
+			if("NULL" == strtoupper($value)) {
171
+				return null;
172
+			} else {
173
+				// no class name specified : use standard Level class
174
+				return LoggerLevel::toLevel($value, $defaultValue);
175
+			}
176
+		}
177 177
 
178
-        $result = $defaultValue;
178
+		$result = $defaultValue;
179 179
 
180
-        $clazz = substr($value, ($hashIndex + 1));
181
-        $levelName = substr($value, 0, $hashIndex);
180
+		$clazz = substr($value, ($hashIndex + 1));
181
+		$levelName = substr($value, 0, $hashIndex);
182 182
 
183
-        // This is degenerate case but you never know.
184
-        if("NULL" == strtoupper($levelName)) {
185
-        	return null;
186
-        }
183
+		// This is degenerate case but you never know.
184
+		if("NULL" == strtoupper($levelName)) {
185
+			return null;
186
+		}
187 187
 
188
-        LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}]:pri=[{$levelName}]");
188
+		LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}]:pri=[{$levelName}]");
189 189
 
190
-        if (!class_exists($clazz))
191
-            @include_once("{$clazz}.php");
190
+		if (!class_exists($clazz))
191
+			@include_once("{$clazz}.php");
192 192
 
193
-        $clazz = basename($clazz);
193
+		$clazz = basename($clazz);
194 194
 
195
-        if (class_exists($clazz)) {
196
-            $result = @call_user_func(array($clazz, 'toLevel'), $value, $defaultValue);
197
-            if (!is_a($result, 'loggerlevel')) {
198
-                LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}] cannot call toLevel(). Returning default.");            
199
-                $result = $defaultValue;
200
-            }
201
-        } else {
202
-            LoggerLog::warn("LoggerOptionConverter::toLevel() class '{$clazz}' doesnt exists.");
203
-        }
204
-        return $result;
205
-    }
195
+		if (class_exists($clazz)) {
196
+			$result = @call_user_func(array($clazz, 'toLevel'), $value, $defaultValue);
197
+			if (!is_a($result, 'loggerlevel')) {
198
+				LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}] cannot call toLevel(). Returning default.");            
199
+				$result = $defaultValue;
200
+			}
201
+		} else {
202
+			LoggerLog::warn("LoggerOptionConverter::toLevel() class '{$clazz}' doesnt exists.");
203
+		}
204
+		return $result;
205
+	}
206 206
 
207
-    /**
208
-     * @param string $value
209
-     * @param float $default
210
-     * @return float
211
-     *
212
-     * @static
213
-     */
214
-    public function toFileSize($value, $default)
215
-    {
216
-        if ($value === null)
217
-            return $default;
207
+	/**
208
+	 * @param string $value
209
+	 * @param float $default
210
+	 * @return float
211
+	 *
212
+	 * @static
213
+	 */
214
+	public function toFileSize($value, $default)
215
+	{
216
+		if ($value === null)
217
+			return $default;
218 218
 
219
-        $s = strtoupper(trim($value));
220
-        $multiplier = (float)1;
221
-        if(($index = strpos($s, 'KB')) !== false) {
222
-            $multiplier = 1024;
223
-            $s = substr($s, 0, $index);
224
-        } elseif(($index = strpos($s, 'MB')) !== false) {
225
-            $multiplier = 1024 * 1024;
226
-            $s = substr($s, 0, $index);
227
-        } elseif(($index = strpos($s, 'GB')) !== false) {
228
-            $multiplier = 1024 * 1024 * 1024;
229
-            $s = substr($s, 0, $index);
230
-        }
231
-        if(is_numeric($s)) {
232
-            return (float)$s * $multiplier;
233
-        } else {
234
-            LoggerLog::warn("LoggerOptionConverter::toFileSize() [{$s}] is not in proper form.");
235
-        }
236
-        return $default;
237
-    }
219
+		$s = strtoupper(trim($value));
220
+		$multiplier = (float)1;
221
+		if(($index = strpos($s, 'KB')) !== false) {
222
+			$multiplier = 1024;
223
+			$s = substr($s, 0, $index);
224
+		} elseif(($index = strpos($s, 'MB')) !== false) {
225
+			$multiplier = 1024 * 1024;
226
+			$s = substr($s, 0, $index);
227
+		} elseif(($index = strpos($s, 'GB')) !== false) {
228
+			$multiplier = 1024 * 1024 * 1024;
229
+			$s = substr($s, 0, $index);
230
+		}
231
+		if(is_numeric($s)) {
232
+			return (float)$s * $multiplier;
233
+		} else {
234
+			LoggerLog::warn("LoggerOptionConverter::toFileSize() [{$s}] is not in proper form.");
235
+		}
236
+		return $default;
237
+	}
238 238
 
239
-    /**
240
-     * Find the value corresponding to <var>$key</var> in
241
-     * <var>$props</var>. Then perform variable substitution on the
242
-     * found value.
243
-     *
244
-     * @param string $key
245
-     * @param array $props
246
-     * @return string
247
-     *
248
-     * @static
249
-     */
250
-    public function findAndSubst($key, $props)
251
-    {
252
-        $value = @$props[$key];
253
-        if(empty($value)) {
254
-            return null;
255
-        }
256
-        return LoggerOptionConverter::substVars($value, $props);
257
-    }
239
+	/**
240
+	 * Find the value corresponding to <var>$key</var> in
241
+	 * <var>$props</var>. Then perform variable substitution on the
242
+	 * found value.
243
+	 *
244
+	 * @param string $key
245
+	 * @param array $props
246
+	 * @return string
247
+	 *
248
+	 * @static
249
+	 */
250
+	public function findAndSubst($key, $props)
251
+	{
252
+		$value = @$props[$key];
253
+		if(empty($value)) {
254
+			return null;
255
+		}
256
+		return LoggerOptionConverter::substVars($value, $props);
257
+	}
258 258
 
259
-    /**
260
-     * Perform variable substitution in string <var>$val</var> from the
261
-     * values of keys found with the {@link getSystemProperty()} method.
262
-     * 
263
-     * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
264
-     * 
265
-     * <p>For example, if the "MY_CONSTANT" contains "value", then
266
-     * the call
267
-     * <code>
268
-     * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
269
-     * </code>
270
-     * will set the variable <i>$s</i> to "Value of key is value.".</p>
271
-     * 
272
-     * <p>If no value could be found for the specified key, then the
273
-     * <var>$props</var> parameter is searched, if the value could not
274
-     * be found there, then substitution defaults to the empty string.</p>
275
-     * 
276
-     * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
277
-     * "inexistentKey", then the call
278
-     * <code>
279
-     * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
280
-     * </code>
281
-     * will set <var>$s</var> to "Value of inexistentKey is []".</p>
282
-     * 
283
-     * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
284
-     * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
285
-     * 
286
-     * @log4j-author Avy Sharell
287
-     * 
288
-     * @param string $val The string on which variable substitution is performed.
289
-     * @param array $props
290
-     * @return string
291
-     *
292
-     * @static
293
-     */
294
-    public function substVars($val, $props = null)
295
-    {
296
-        LoggerLog::debug("LoggerOptionConverter::substVars():val=[{$val}]");
259
+	/**
260
+	 * Perform variable substitution in string <var>$val</var> from the
261
+	 * values of keys found with the {@link getSystemProperty()} method.
262
+	 * 
263
+	 * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
264
+	 * 
265
+	 * <p>For example, if the "MY_CONSTANT" contains "value", then
266
+	 * the call
267
+	 * <code>
268
+	 * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
269
+	 * </code>
270
+	 * will set the variable <i>$s</i> to "Value of key is value.".</p>
271
+	 * 
272
+	 * <p>If no value could be found for the specified key, then the
273
+	 * <var>$props</var> parameter is searched, if the value could not
274
+	 * be found there, then substitution defaults to the empty string.</p>
275
+	 * 
276
+	 * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
277
+	 * "inexistentKey", then the call
278
+	 * <code>
279
+	 * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
280
+	 * </code>
281
+	 * will set <var>$s</var> to "Value of inexistentKey is []".</p>
282
+	 * 
283
+	 * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
284
+	 * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
285
+	 * 
286
+	 * @log4j-author Avy Sharell
287
+	 * 
288
+	 * @param string $val The string on which variable substitution is performed.
289
+	 * @param array $props
290
+	 * @return string
291
+	 *
292
+	 * @static
293
+	 */
294
+	public function substVars($val, $props = null)
295
+	{
296
+		LoggerLog::debug("LoggerOptionConverter::substVars():val=[{$val}]");
297 297
         
298
-        $sbuf = '';
299
-        $i = 0;
300
-        while(true) {
301
-            $j = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_START, $i);
302
-            if ($j === false) {
303
-                LoggerLog::debug("LoggerOptionConverter::substVars() no more variables");
304
-	            // no more variables
305
-	            if ($i == 0) { // this is a simple string
306
-                    LoggerLog::debug("LoggerOptionConverter::substVars() simple string");
307
-	                return $val;
308
-            	} else { // add the tail string which contails no variables and return the result.
309
-                    $sbuf .= substr($val, $i);
310
-                    LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]. Returning sbuf");                    
311
-                    return $sbuf;
312
-	            }
313
-            } else {
298
+		$sbuf = '';
299
+		$i = 0;
300
+		while(true) {
301
+			$j = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_START, $i);
302
+			if ($j === false) {
303
+				LoggerLog::debug("LoggerOptionConverter::substVars() no more variables");
304
+				// no more variables
305
+				if ($i == 0) { // this is a simple string
306
+					LoggerLog::debug("LoggerOptionConverter::substVars() simple string");
307
+					return $val;
308
+				} else { // add the tail string which contails no variables and return the result.
309
+					$sbuf .= substr($val, $i);
310
+					LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]. Returning sbuf");                    
311
+					return $sbuf;
312
+				}
313
+			} else {
314 314
             
315
-	            $sbuf .= substr($val, $i, $j-$i);
316
-                LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]:i={$i}:j={$j}.");
317
-            	$k = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_STOP, $j);
318
-            	if ($k === false) {
319
-                    LoggerLog::warn(
320
-                        "LoggerOptionConverter::substVars() " .
321
-                        "'{$val}' has no closing brace. Opening brace at position {$j}."
322
-                    );
323
-                    return '';
324
-	            } else {
325
-	                $j += LOG4PHP_OPTION_CONVERTER_DELIM_START_LEN;
326
-	                $key = substr($val, $j, $k - $j);
327
-                    // first try in System properties
328
-	                $replacement = LoggerOptionConverter::getSystemProperty($key, null);
329
-	                // then try props parameter
330
-	                if($replacement == null && $props !== null) {
331
-            	        $replacement = @$props[$key];
332
-	                }
315
+				$sbuf .= substr($val, $i, $j-$i);
316
+				LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]:i={$i}:j={$j}.");
317
+				$k = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_STOP, $j);
318
+				if ($k === false) {
319
+					LoggerLog::warn(
320
+						"LoggerOptionConverter::substVars() " .
321
+						"'{$val}' has no closing brace. Opening brace at position {$j}."
322
+					);
323
+					return '';
324
+				} else {
325
+					$j += LOG4PHP_OPTION_CONVERTER_DELIM_START_LEN;
326
+					$key = substr($val, $j, $k - $j);
327
+					// first try in System properties
328
+					$replacement = LoggerOptionConverter::getSystemProperty($key, null);
329
+					// then try props parameter
330
+					if($replacement == null && $props !== null) {
331
+						$replacement = @$props[$key];
332
+					}
333 333
 
334
-                    if(!empty($replacement)) {
335
-	                    // Do variable substitution on the replacement string
336
-                	    // such that we can solve "Hello ${x2}" as "Hello p1" 
337
-                        // the where the properties are
338
-                	    // x1=p1
339
-                        // x2=${x1}
340
-	                    $recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
341
-                	    $sbuf .= $recursiveReplacement;
342
-	                }
343
-	                $i = $k + LOG4PHP_OPTION_CONVERTER_DELIM_STOP_LEN;
344
-	            }
345
-            }
346
-        }
347
-    }
334
+					if(!empty($replacement)) {
335
+						// Do variable substitution on the replacement string
336
+						// such that we can solve "Hello ${x2}" as "Hello p1" 
337
+						// the where the properties are
338
+						// x1=p1
339
+						// x2=${x1}
340
+						$recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
341
+						$sbuf .= $recursiveReplacement;
342
+					}
343
+					$i = $k + LOG4PHP_OPTION_CONVERTER_DELIM_STOP_LEN;
344
+				}
345
+			}
346
+		}
347
+	}
348 348
 
349 349
 }
350 350
 ?>
351 351
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/helpers/LoggerTransform.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_END',            ']]>');
27 27
 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END',     ']]&gt;');
28 28
 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END',   
29
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_END .
30
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END .
31
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_START 
29
+	LOG4PHP_LOGGER_TRANSFORM_CDATA_END .
30
+	LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END .
31
+	LOG4PHP_LOGGER_TRANSFORM_CDATA_START 
32 32
 );
33 33
 
34 34
 /**
@@ -43,53 +43,53 @@  discard block
 block discarded – undo
43 43
  */
44 44
 class LoggerTransform {
45 45
 
46
-    /**
47
-    * This method takes a string which may contain HTML tags (ie,
48
-    * &lt;b&gt;, &lt;table&gt;, etc) and replaces any '&lt;' and '&gt;'
49
-    * characters with respective predefined entity references.
50
-    *
51
-    * @param string $input The text to be converted.
52
-    * @return string The input string with the characters '&lt;' and '&gt;' replaced with
53
-    *                &amp;lt; and &amp;gt; respectively.
54
-    * @static  
55
-    */
56
-    public function escapeTags($input)
57
-    {
58
-        //Check if the string is null or zero length -- if so, return
59
-        //what was sent in.
46
+	/**
47
+	 * This method takes a string which may contain HTML tags (ie,
48
+	 * &lt;b&gt;, &lt;table&gt;, etc) and replaces any '&lt;' and '&gt;'
49
+	 * characters with respective predefined entity references.
50
+	 *
51
+	 * @param string $input The text to be converted.
52
+	 * @return string The input string with the characters '&lt;' and '&gt;' replaced with
53
+	 *                &amp;lt; and &amp;gt; respectively.
54
+	 * @static  
55
+	 */
56
+	public function escapeTags($input)
57
+	{
58
+		//Check if the string is null or zero length -- if so, return
59
+		//what was sent in.
60 60
 
61
-        if(empty($input))
62
-            return $input;
61
+		if(empty($input))
62
+			return $input;
63 63
 
64
-        //Use a StringBuffer in lieu of String concatenation -- it is
65
-        //much more efficient this way.
64
+		//Use a StringBuffer in lieu of String concatenation -- it is
65
+		//much more efficient this way.
66 66
 
67
-        return htmlspecialchars($input, ENT_NOQUOTES);
68
-    }
67
+		return htmlspecialchars($input, ENT_NOQUOTES);
68
+	}
69 69
 
70
-    /**
71
-    * Ensures that embeded CDEnd strings (]]&gt;) are handled properly
72
-    * within message, NDC and throwable tag text.
73
-    *
74
-    * @param string $buf    String holding the XML data to this point.  The
75
-    *                       initial CDStart (<![CDATA[) and final CDEnd (]]>) 
76
-    *                       of the CDATA section are the responsibility of 
77
-    *                       the calling method.
78
-    * @param string &str    The String that is inserted into an existing 
79
-    *                       CDATA Section within buf.
80
-    * @static  
81
-    */
82
-    public function appendEscapingCDATA(&$buf, $str)
83
-    {
84
-        if(empty($str))
85
-            return;
70
+	/**
71
+	 * Ensures that embeded CDEnd strings (]]&gt;) are handled properly
72
+	 * within message, NDC and throwable tag text.
73
+	 *
74
+	 * @param string $buf    String holding the XML data to this point.  The
75
+	 *                       initial CDStart (<![CDATA[) and final CDEnd (]]>) 
76
+	 *                       of the CDATA section are the responsibility of 
77
+	 *                       the calling method.
78
+	 * @param string &str    The String that is inserted into an existing 
79
+	 *                       CDATA Section within buf.
80
+	 * @static  
81
+	 */
82
+	public function appendEscapingCDATA(&$buf, $str)
83
+	{
84
+		if(empty($str))
85
+			return;
86 86
     
87
-        $rStr = str_replace(
88
-            LOG4PHP_LOGGER_TRANSFORM_CDATA_END,
89
-            LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END,
90
-            $str
91
-        );
92
-        $buf .= $rStr;
93
-    }
87
+		$rStr = str_replace(
88
+			LOG4PHP_LOGGER_TRANSFORM_CDATA_END,
89
+			LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END,
90
+			$str
91
+		);
92
+		$buf .= $rStr;
93
+	}
94 94
 }
95 95
 ?>
96 96
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/helpers/LoggerFormattingInfo.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -37,25 +37,25 @@
 block discarded – undo
37 37
  */
38 38
 class LoggerFormattingInfo {
39 39
 
40
-    var $min        = -1;
41
-    var $max        = 0x7FFFFFFF;
42
-    var $leftAlign  = false;
40
+	var $min        = -1;
41
+	var $max        = 0x7FFFFFFF;
42
+	var $leftAlign  = false;
43 43
 
44
-    /**
45
-     * Constructor
46
-     */
47
-    public function LoggerFormattingInfo() {}
44
+	/**
45
+	 * Constructor
46
+	 */
47
+	public function LoggerFormattingInfo() {}
48 48
     
49
-    public function reset()
50
-    {
51
-        $this->min          = -1;
52
-        $this->max          = 0x7FFFFFFF;
53
-        $this->leftAlign    = false;      
54
-    }
49
+	public function reset()
50
+	{
51
+		$this->min          = -1;
52
+		$this->max          = 0x7FFFFFFF;
53
+		$this->leftAlign    = false;      
54
+	}
55 55
 
56
-    public function dump()
57
-    {
58
-        LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
59
-    }
56
+	public function dump()
57
+	{
58
+		LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
59
+	}
60 60
 } 
61 61
 ?>
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/helpers/LoggerPatternParser.php 1 patch
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
24 24
 
25 25
 if (!defined('LOG4PHP_LINE_SEP')) {
26
-    if (substr(php_uname(), 0, 7) == "Windows") {
27
-        /**
28
-         * @ignore
29
-         */
30
-        define('LOG4PHP_LINE_SEP', "\r\n");
31
-    } else {
32
-        /**
33
-         * @ignore
34
-         */
35
-        define('LOG4PHP_LINE_SEP', "\n");
36
-    }
26
+	if (substr(php_uname(), 0, 7) == "Windows") {
27
+		/**
28
+		 * @ignore
29
+		 */
30
+		define('LOG4PHP_LINE_SEP', "\r\n");
31
+	} else {
32
+		/**
33
+		 * @ignore
34
+		 */
35
+		define('LOG4PHP_LINE_SEP', "\n");
36
+	}
37 37
 }
38 38
  
39 39
 /**
@@ -83,335 +83,335 @@  discard block
 block discarded – undo
83 83
  */
84 84
 class LoggerPatternParser {
85 85
 
86
-    var $state;
87
-    var $currentLiteral;
88
-    var $patternLength;
89
-    var $i;
86
+	var $state;
87
+	var $currentLiteral;
88
+	var $patternLength;
89
+	var $i;
90 90
     
91
-    /**
92
-     * @var LoggerPatternConverter
93
-     */
94
-    var $head = null;
91
+	/**
92
+	 * @var LoggerPatternConverter
93
+	 */
94
+	var $head = null;
95 95
      
96
-    /**
97
-     * @var LoggerPatternConverter
98
-     */
99
-    var $tail = null;
96
+	/**
97
+	 * @var LoggerPatternConverter
98
+	 */
99
+	var $tail = null;
100 100
     
101
-    /**
102
-     * @var LoggerFormattingInfo
103
-     */
104
-    var $formattingInfo;
101
+	/**
102
+	 * @var LoggerFormattingInfo
103
+	 */
104
+	var $formattingInfo;
105 105
     
106
-    /**
107
-     * @var string pattern to parse
108
-     */
109
-    var $pattern;
106
+	/**
107
+	 * @var string pattern to parse
108
+	 */
109
+	var $pattern;
110 110
 
111
-    /**
112
-     * Constructor 
113
-     *
114
-     * @param string $pattern
115
-     */
116
-    public function LoggerPatternParser($pattern)
117
-    {
118
-        LoggerLog::debug("LoggerPatternParser::LoggerPatternParser() pattern='$pattern'");
111
+	/**
112
+	 * Constructor 
113
+	 *
114
+	 * @param string $pattern
115
+	 */
116
+	public function LoggerPatternParser($pattern)
117
+	{
118
+		LoggerLog::debug("LoggerPatternParser::LoggerPatternParser() pattern='$pattern'");
119 119
     
120
-        $this->pattern = $pattern;
121
-        $this->patternLength =  strlen($pattern);
122
-        $this->formattingInfo = new LoggerFormattingInfo();
123
-        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
124
-    }
120
+		$this->pattern = $pattern;
121
+		$this->patternLength =  strlen($pattern);
122
+		$this->formattingInfo = new LoggerFormattingInfo();
123
+		$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
124
+	}
125 125
 
126
-    /**
127
-     * @param LoggerPatternConverter $pc
128
-     */
129
-    public function addToList($pc)
130
-    {
131
-        // LoggerLog::debug("LoggerPatternParser::addToList()");
126
+	/**
127
+	 * @param LoggerPatternConverter $pc
128
+	 */
129
+	public function addToList($pc)
130
+	{
131
+		// LoggerLog::debug("LoggerPatternParser::addToList()");
132 132
     
133
-        if($this->head == null) {
134
-            $this->head = $pc;
135
-            $this->tail =& $this->head;
136
-        } else {
137
-            $this->tail->next = $pc;
138
-            $this->tail =& $this->tail->next;
139
-        }
140
-    }
133
+		if($this->head == null) {
134
+			$this->head = $pc;
135
+			$this->tail =& $this->head;
136
+		} else {
137
+			$this->tail->next = $pc;
138
+			$this->tail =& $this->tail->next;
139
+		}
140
+	}
141 141
 
142
-    /**
143
-     * @return string
144
-     */
145
-    public function extractOption()
146
-    {
147
-        if(($this->i < $this->patternLength) && ($this->pattern{$this->i} == '{')) {
148
-            $end = strpos($this->pattern, '}' , $this->i);
149
-            if ($end !== false) {
150
-                $r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
151
-	            $this->i= $end + 1;
152
-        	    return $r;
153
-            }
154
-        }
155
-        return null;
156
-    }
142
+	/**
143
+	 * @return string
144
+	 */
145
+	public function extractOption()
146
+	{
147
+		if(($this->i < $this->patternLength) && ($this->pattern{$this->i} == '{')) {
148
+			$end = strpos($this->pattern, '}' , $this->i);
149
+			if ($end !== false) {
150
+				$r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
151
+				$this->i= $end + 1;
152
+				return $r;
153
+			}
154
+		}
155
+		return null;
156
+	}
157 157
 
158
-    /**
159
-     * The option is expected to be in decimal and positive. In case of
160
-     * error, zero is returned.  
161
-     */
162
-    public function extractPrecisionOption()
163
-    {
164
-        $opt = $this->extractOption();
165
-        $r = 0;
166
-        if ($opt !== null) {
167
-            if (is_numeric($opt)) {
168
-    	        $r = (int)$opt;
169
-            	if($r <= 0) {
170
-            	    LoggerLog::warn("Precision option ({$opt}) isn't a positive integer.");
171
-            	    $r = 0;
172
-            	}
173
-            } else {
174
-                LoggerLog::warn("Category option \"{$opt}\" not a decimal integer.");
175
-            }
176
-        }
177
-        return $r;
178
-    }
158
+	/**
159
+	 * The option is expected to be in decimal and positive. In case of
160
+	 * error, zero is returned.  
161
+	 */
162
+	public function extractPrecisionOption()
163
+	{
164
+		$opt = $this->extractOption();
165
+		$r = 0;
166
+		if ($opt !== null) {
167
+			if (is_numeric($opt)) {
168
+				$r = (int)$opt;
169
+				if($r <= 0) {
170
+					LoggerLog::warn("Precision option ({$opt}) isn't a positive integer.");
171
+					$r = 0;
172
+				}
173
+			} else {
174
+				LoggerLog::warn("Category option \"{$opt}\" not a decimal integer.");
175
+			}
176
+		}
177
+		return $r;
178
+	}
179 179
 
180
-    public function parse()
181
-    {
182
-        LoggerLog::debug("LoggerPatternParser::parse()");
180
+	public function parse()
181
+	{
182
+		LoggerLog::debug("LoggerPatternParser::parse()");
183 183
     
184
-        $c = '';
185
-        $this->i = 0;
186
-        $this->currentLiteral = '';
187
-        while ($this->i < $this->patternLength) {
188
-            $c = $this->pattern{$this->i++};
184
+		$c = '';
185
+		$this->i = 0;
186
+		$this->currentLiteral = '';
187
+		while ($this->i < $this->patternLength) {
188
+			$c = $this->pattern{$this->i++};
189 189
 //            LoggerLog::debug("LoggerPatternParser::parse() char is now '$c' and currentLiteral is '{$this->currentLiteral}'");            
190
-            switch($this->state) {
191
-                case LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE:
192
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE'");
193
-                    // In literal state, the last char is always a literal.
194
-                    if($this->i == $this->patternLength) {
195
-                        $this->currentLiteral .= $c;
196
-                        continue;
197
-                    }
198
-                    if($c == LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR) {
199
-                        // LoggerLog::debug("LoggerPatternParser::parse() char is an escape char");                    
200
-                        // peek at the next char.
201
-                        switch($this->pattern{$this->i}) {
202
-                            case LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR:
203
-                                // LoggerLog::debug("LoggerPatternParser::parse() next char is an escape char");                    
204
-                                $this->currentLiteral .= $c;
205
-                                $this->i++; // move pointer
206
-                                break;
207
-                            case 'n':
208
-                                // LoggerLog::debug("LoggerPatternParser::parse() next char is 'n'");                            
209
-                                $this->currentLiteral .= LOG4PHP_LINE_SEP;
210
-                                $this->i++; // move pointer
211
-                                break;
212
-                            default:
213
-                                if(strlen($this->currentLiteral) != 0) {
214
-                                    $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
215
-                                    LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
216
-                                }
217
-                                $this->currentLiteral = $c;
218
-                                $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE;
219
-                                $this->formattingInfo->reset();
220
-                        }
221
-                    } else {
222
-                        $this->currentLiteral .= $c;
223
-                    }
224
-                    break;
225
-              case LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE:
226
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE'");              
227
-                	$this->currentLiteral .= $c;
228
-                	switch($c) {
229
-                    	case '-':
230
-                            $this->formattingInfo->leftAlign = true;
231
-                            break;
232
-                    	case '.':
233
-                            $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
234
-	                        break;
235
-                    	default:
236
-                            if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
237
-                        	    $this->formattingInfo->min = ord($c) - ord('0');
238
-                        	    $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE;
239
-                            } else {
240
-                                $this->finalizeConverter($c);
241
-                            }
242
-                  	} // switch
243
-                    break;
244
-              case LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE:
245
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE'");              
246
-	                $this->currentLiteral .= $c;
247
-                    if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
248
-                        $this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord(c) - ord('0'));
249
-                	} elseif ($c == '.') {
250
-                        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
251
-                    } else {
252
-                    	$this->finalizeConverter($c);
253
-                	}
254
-                	break;
255
-              case LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE:
256
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE'");              
257
-                	$this->currentLiteral .= $c;
258
-                    if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
259
-                        $this->formattingInfo->max = ord($c) - ord('0');
260
-	                    $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE;
261
-                    } else {
262
-                	  LoggerLog::warn("LoggerPatternParser::parse() Error occured in position {$this->i}. Was expecting digit, instead got char \"{$c}\".");
263
-	                  $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
264
-                    }
265
-                	break;
266
-              case LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE:
267
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE'");              
268
-                	$this->currentLiteral .= $c;
269
-                    if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
270
-                        $this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
271
-	                } else {
272
-                	  $this->finalizeConverter($c);
273
-                      $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
274
-	                }
275
-                	break;
276
-            } // switch
277
-        } // while
278
-        if(strlen($this->currentLiteral) != 0) {
279
-            $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
280
-            // LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
281
-        }
282
-        return $this->head;
283
-    }
190
+			switch($this->state) {
191
+				case LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE:
192
+					// LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE'");
193
+					// In literal state, the last char is always a literal.
194
+					if($this->i == $this->patternLength) {
195
+						$this->currentLiteral .= $c;
196
+						continue;
197
+					}
198
+					if($c == LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR) {
199
+						// LoggerLog::debug("LoggerPatternParser::parse() char is an escape char");                    
200
+						// peek at the next char.
201
+						switch($this->pattern{$this->i}) {
202
+							case LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR:
203
+								// LoggerLog::debug("LoggerPatternParser::parse() next char is an escape char");                    
204
+								$this->currentLiteral .= $c;
205
+								$this->i++; // move pointer
206
+								break;
207
+							case 'n':
208
+								// LoggerLog::debug("LoggerPatternParser::parse() next char is 'n'");                            
209
+								$this->currentLiteral .= LOG4PHP_LINE_SEP;
210
+								$this->i++; // move pointer
211
+								break;
212
+							default:
213
+								if(strlen($this->currentLiteral) != 0) {
214
+									$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
215
+									LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
216
+								}
217
+								$this->currentLiteral = $c;
218
+								$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE;
219
+								$this->formattingInfo->reset();
220
+						}
221
+					} else {
222
+						$this->currentLiteral .= $c;
223
+					}
224
+					break;
225
+			  case LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE:
226
+					// LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE'");              
227
+					$this->currentLiteral .= $c;
228
+					switch($c) {
229
+						case '-':
230
+							$this->formattingInfo->leftAlign = true;
231
+							break;
232
+						case '.':
233
+							$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
234
+							break;
235
+						default:
236
+							if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
237
+								$this->formattingInfo->min = ord($c) - ord('0');
238
+								$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE;
239
+							} else {
240
+								$this->finalizeConverter($c);
241
+							}
242
+				  	} // switch
243
+					break;
244
+			  case LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE:
245
+					// LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE'");              
246
+					$this->currentLiteral .= $c;
247
+					if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
248
+						$this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord(c) - ord('0'));
249
+					} elseif ($c == '.') {
250
+						$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
251
+					} else {
252
+						$this->finalizeConverter($c);
253
+					}
254
+					break;
255
+			  case LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE:
256
+					// LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE'");              
257
+					$this->currentLiteral .= $c;
258
+					if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
259
+						$this->formattingInfo->max = ord($c) - ord('0');
260
+						$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE;
261
+					} else {
262
+					  LoggerLog::warn("LoggerPatternParser::parse() Error occured in position {$this->i}. Was expecting digit, instead got char \"{$c}\".");
263
+					  $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
264
+					}
265
+					break;
266
+			  case LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE:
267
+					// LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE'");              
268
+					$this->currentLiteral .= $c;
269
+					if(ord($c) >= ord('0') && ord($c) <= ord('9')) {
270
+						$this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
271
+					} else {
272
+					  $this->finalizeConverter($c);
273
+					  $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
274
+					}
275
+					break;
276
+			} // switch
277
+		} // while
278
+		if(strlen($this->currentLiteral) != 0) {
279
+			$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
280
+			// LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
281
+		}
282
+		return $this->head;
283
+	}
284 284
 
285
-    public function finalizeConverter($c)
286
-    {
287
-        LoggerLog::debug("LoggerPatternParser::finalizeConverter() with char '$c'");    
285
+	public function finalizeConverter($c)
286
+	{
287
+		LoggerLog::debug("LoggerPatternParser::finalizeConverter() with char '$c'");    
288 288
 
289
-        $pc = null;
290
-        switch($c) {
291
-            case 'c':
292
-                $pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
293
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() CATEGORY converter.");
294
-                $this->currentLiteral = '';
295
-                break;
296
-            case 'C':
297
-                $pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
298
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() CLASSNAME converter.");
299
-                $this->currentLiteral = '';
300
-                break;
301
-            case 'd':
302
-                $dateFormatStr = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
303
-                $dOpt = $this->extractOption();
289
+		$pc = null;
290
+		switch($c) {
291
+			case 'c':
292
+				$pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
293
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() CATEGORY converter.");
294
+				$this->currentLiteral = '';
295
+				break;
296
+			case 'C':
297
+				$pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
298
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() CLASSNAME converter.");
299
+				$this->currentLiteral = '';
300
+				break;
301
+			case 'd':
302
+				$dateFormatStr = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
303
+				$dOpt = $this->extractOption();
304 304
 
305
-                if($dOpt !== null)
306
-	                $dateFormatStr = $dOpt;
305
+				if($dOpt !== null)
306
+					$dateFormatStr = $dOpt;
307 307
                     
308
-                if ($dateFormatStr == 'ISO8601') {
309
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
310
-                } elseif($dateFormatStr == 'ABSOLUTE') {
311
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ABSOLUTE;
312
-                } elseif($dateFormatStr == 'DATE') {
313
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE;
314
-                } else {
315
-                    $df = $dateFormatStr;
316
-                    if ($df == null) {
317
-                        $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
318
-                    }
319
-	            }
320
-                $pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
321
-                $this->currentLiteral = '';
322
-                break;
323
-            case 'F':
324
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER);
325
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() File name converter.");
326
-                //formattingInfo.dump();
327
-                $this->currentLiteral = '';
328
-                break;
329
-            case 'l':
330
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER);
331
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() Location converter.");
332
-                //formattingInfo.dump();
333
-                $this->currentLiteral = '';
334
-                break;
335
-            case 'L':
336
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER);
337
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() LINE NUMBER converter.");
338
-                //formattingInfo.dump();
339
-                $this->currentLiteral = '';
340
-                break;
341
-            case 'm':
342
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER);
343
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() MESSAGE converter.");
344
-                //formattingInfo.dump();
345
-                $this->currentLiteral = '';
346
-                break;
347
-            case 'M':
348
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER);
349
-                //LogLog.debug("METHOD converter.");
350
-                //formattingInfo.dump();
351
-                $this->currentLiteral = '';
352
-                break;
353
-            case 'p':
354
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER);
355
-                //LogLog.debug("LEVEL converter.");
356
-                //formattingInfo.dump();
357
-                $this->currentLiteral = '';
358
-                break;
359
-            case 'r':
360
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER);
361
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() RELATIVE TIME converter.");
362
-                //formattingInfo.dump();
363
-                $this->currentLiteral = '';
364
-                break;
365
-            case 't':
366
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER);
367
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() THREAD converter.");
368
-                //formattingInfo.dump();
369
-                $this->currentLiteral = '';
370
-                break;
371
-            case 'u':
372
-                if($this->i < $this->patternLength) {
373
-	                $cNext = $this->pattern{$this->i};
374
-                    if(ord($cNext) >= ord('0') && ord($cNext) <= ord('9')) {
375
-	                    $pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
376
-                        LoggerLog::debug("LoggerPatternParser::finalizeConverter() USER converter [{$cNext}].");
377
-	                    // formattingInfo.dump();
378
-                        $this->currentLiteral = '';
379
-	                    $this->i++;
380
-	                } else {
381
-                        LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char '{$cNext}' at position {$this->i}.");
382
-                    }
383
-                }
384
-                break;
385
-            case 'x':
386
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER);
387
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() NDC converter.");
388
-                $this->currentLiteral = '';
389
-                break;
308
+				if ($dateFormatStr == 'ISO8601') {
309
+					$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
310
+				} elseif($dateFormatStr == 'ABSOLUTE') {
311
+					$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ABSOLUTE;
312
+				} elseif($dateFormatStr == 'DATE') {
313
+					$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE;
314
+				} else {
315
+					$df = $dateFormatStr;
316
+					if ($df == null) {
317
+						$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
318
+					}
319
+				}
320
+				$pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
321
+				$this->currentLiteral = '';
322
+				break;
323
+			case 'F':
324
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER);
325
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() File name converter.");
326
+				//formattingInfo.dump();
327
+				$this->currentLiteral = '';
328
+				break;
329
+			case 'l':
330
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER);
331
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() Location converter.");
332
+				//formattingInfo.dump();
333
+				$this->currentLiteral = '';
334
+				break;
335
+			case 'L':
336
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER);
337
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() LINE NUMBER converter.");
338
+				//formattingInfo.dump();
339
+				$this->currentLiteral = '';
340
+				break;
341
+			case 'm':
342
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER);
343
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() MESSAGE converter.");
344
+				//formattingInfo.dump();
345
+				$this->currentLiteral = '';
346
+				break;
347
+			case 'M':
348
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER);
349
+				//LogLog.debug("METHOD converter.");
350
+				//formattingInfo.dump();
351
+				$this->currentLiteral = '';
352
+				break;
353
+			case 'p':
354
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER);
355
+				//LogLog.debug("LEVEL converter.");
356
+				//formattingInfo.dump();
357
+				$this->currentLiteral = '';
358
+				break;
359
+			case 'r':
360
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER);
361
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() RELATIVE TIME converter.");
362
+				//formattingInfo.dump();
363
+				$this->currentLiteral = '';
364
+				break;
365
+			case 't':
366
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER);
367
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() THREAD converter.");
368
+				//formattingInfo.dump();
369
+				$this->currentLiteral = '';
370
+				break;
371
+			case 'u':
372
+				if($this->i < $this->patternLength) {
373
+					$cNext = $this->pattern{$this->i};
374
+					if(ord($cNext) >= ord('0') && ord($cNext) <= ord('9')) {
375
+						$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
376
+						LoggerLog::debug("LoggerPatternParser::finalizeConverter() USER converter [{$cNext}].");
377
+						// formattingInfo.dump();
378
+						$this->currentLiteral = '';
379
+						$this->i++;
380
+					} else {
381
+						LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char '{$cNext}' at position {$this->i}.");
382
+					}
383
+				}
384
+				break;
385
+			case 'x':
386
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER);
387
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() NDC converter.");
388
+				$this->currentLiteral = '';
389
+				break;
390 390
 
391
-            case 'X':
392
-                $xOpt = $this->extractOption();
393
-                $pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
394
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() MDC converter.");
395
-                $this->currentLiteral = '';
396
-                break;
397
-            default:
398
-                LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char [$c] at position {$this->i} in conversion pattern.");
399
-                $pc = new LoggerLiteralPatternConverter($this->currentLiteral);
400
-                $this->currentLiteral = '';
401
-        }
402
-        $this->addConverter($pc);
403
-    }
391
+			case 'X':
392
+				$xOpt = $this->extractOption();
393
+				$pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
394
+				LoggerLog::debug("LoggerPatternParser::finalizeConverter() MDC converter.");
395
+				$this->currentLiteral = '';
396
+				break;
397
+			default:
398
+				LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char [$c] at position {$this->i} in conversion pattern.");
399
+				$pc = new LoggerLiteralPatternConverter($this->currentLiteral);
400
+				$this->currentLiteral = '';
401
+		}
402
+		$this->addConverter($pc);
403
+	}
404 404
 
405
-    public function addConverter($pc)
406
-    {
407
-        $this->currentLiteral = '';
408
-        // Add the pattern converter to the list.
409
-        $this->addToList($pc);
410
-        // Next pattern is assumed to be a literal.
411
-        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
412
-        // Reset formatting info
413
-        $this->formattingInfo->reset();
414
-    }
405
+	public function addConverter($pc)
406
+	{
407
+		$this->currentLiteral = '';
408
+		// Add the pattern converter to the list.
409
+		$this->addToList($pc);
410
+		// Next pattern is assumed to be a literal.
411
+		$this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
412
+		// Reset formatting info
413
+		$this->formattingInfo->reset();
414
+	}
415 415
 }
416 416
 
417 417
 ?>
418 418
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/LoggerManager.php 1 patch
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -47,101 +47,101 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		return self::$loggerCache;
49 49
 	}
50
-    /**
51
-     * check if a given logger exists.
52
-     * 
53
-     * @param string $name logger name 
54
-     * @static
55
-     * @return boolean
56
-     */
57
-    public function exists($name)
58
-    {
59
-        $repository =& LoggerManager::getLoggerRepository();
60
-        return $repository->exists($name);
61
-    }
50
+	/**
51
+	 * check if a given logger exists.
52
+	 * 
53
+	 * @param string $name logger name 
54
+	 * @static
55
+	 * @return boolean
56
+	 */
57
+	public function exists($name)
58
+	{
59
+		$repository =& LoggerManager::getLoggerRepository();
60
+		return $repository->exists($name);
61
+	}
62 62
 
63
-    /**
64
-     * Returns an array this whole Logger instances.
65
-     * 
66
-     * @static
67
-     * @see Logger
68
-     * @return array
69
-     */
70
-    public function getCurrentLoggers()
71
-    {
72
-        $repository =& LoggerManager::getLoggerRepository();
73
-        return $repository->getCurrentLoggers();
74
-    }
63
+	/**
64
+	 * Returns an array this whole Logger instances.
65
+	 * 
66
+	 * @static
67
+	 * @see Logger
68
+	 * @return array
69
+	 */
70
+	public function getCurrentLoggers()
71
+	{
72
+		$repository =& LoggerManager::getLoggerRepository();
73
+		return $repository->getCurrentLoggers();
74
+	}
75 75
     
76
-    /**
77
-     * Returns the root logger.
78
-     * 
79
-     * @static
80
-     * @return object
81
-     * @see LoggerRoot
82
-     */
83
-    public function &getRootLogger()
84
-    {
85
-        $repository =& LoggerManager::getLoggerRepository();
86
-        return $repository->getRootLogger();
87
-    }
76
+	/**
77
+	 * Returns the root logger.
78
+	 * 
79
+	 * @static
80
+	 * @return object
81
+	 * @see LoggerRoot
82
+	 */
83
+	public function &getRootLogger()
84
+	{
85
+		$repository =& LoggerManager::getLoggerRepository();
86
+		return $repository->getRootLogger();
87
+	}
88 88
     
89
-    /**
90
-     * Returns the specified Logger.
91
-     * 
92
-     * @param string $name logger name
93
-     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
94
-     * @static
95
-     * @return Logger
96
-     */
97
-    public function &getLogger($name, $factory = null)
98
-    {
99
-        $repository =& LoggerManager::getLoggerRepository();
100
-        return $repository->getLogger($name, $factory);
101
-    }
89
+	/**
90
+	 * Returns the specified Logger.
91
+	 * 
92
+	 * @param string $name logger name
93
+	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
94
+	 * @static
95
+	 * @return Logger
96
+	 */
97
+	public function &getLogger($name, $factory = null)
98
+	{
99
+		$repository =& LoggerManager::getLoggerRepository();
100
+		return $repository->getLogger($name, $factory);
101
+	}
102 102
     
103
-    /**
104
-     * Returns the LoggerHierarchy.
105
-     * 
106
-     * @static
107
-     * @return LoggerHierarchy
108
-     */
109
-    public function &getLoggerRepository()
110
-    {
111
-        return LoggerHierarchy::singleton();    
112
-    }
103
+	/**
104
+	 * Returns the LoggerHierarchy.
105
+	 * 
106
+	 * @static
107
+	 * @return LoggerHierarchy
108
+	 */
109
+	public function &getLoggerRepository()
110
+	{
111
+		return LoggerHierarchy::singleton();    
112
+	}
113 113
     
114 114
 
115
-    /**
116
-     * Destroy loggers object tree.
117
-     * 
118
-     * @static
119
-     * @return boolean 
120
-     */
121
-    public function resetConfiguration()
122
-    {
123
-        $repository =& LoggerManager::getLoggerRepository();    
124
-        return $repository->resetConfiguration();    
125
-    }
115
+	/**
116
+	 * Destroy loggers object tree.
117
+	 * 
118
+	 * @static
119
+	 * @return boolean 
120
+	 */
121
+	public function resetConfiguration()
122
+	{
123
+		$repository =& LoggerManager::getLoggerRepository();    
124
+		return $repository->resetConfiguration();    
125
+	}
126 126
     
127
-    /**
128
-     * Does nothing.
129
-     * @static
130
-     */
131
-    public function setRepositorySelector($selector, $guard)
132
-    {
133
-        return;
134
-    }
127
+	/**
128
+	 * Does nothing.
129
+	 * @static
130
+	 */
131
+	public function setRepositorySelector($selector, $guard)
132
+	{
133
+		return;
134
+	}
135 135
     
136
-    /**
137
-     * Safely close all appenders.
138
-     * @static
139
-     */
140
-    public function shutdown()
141
-    {
142
-        $repository =& LoggerManager::getLoggerRepository();    
143
-        return $repository->shutdown();    
144
-    }
136
+	/**
137
+	 * Safely close all appenders.
138
+	 * @static
139
+	 */
140
+	public function shutdown()
141
+	{
142
+		$repository =& LoggerManager::getLoggerRepository();    
143
+		return $repository->shutdown();    
144
+	}
145 145
 }
146 146
 
147 147
 // ---------------------------------------------------------------------------
@@ -149,94 +149,94 @@  discard block
 block discarded – undo
149 149
 // ---------------------------------------------------------------------------
150 150
 
151 151
 if (!defined('LOG4PHP_DEFAULT_INIT_OVERRIDE')) {
152
-    if (isset($_ENV['log4php.defaultInitOverride'])) {
153
-        /**
154
-         * @ignore
155
-         */
156
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
157
-            LoggerOptionConverter::toBoolean($_ENV['log4php.defaultInitOverride'], false)
158
-        );
159
-    } elseif (isset($GLOBALS['log4php.defaultInitOverride'])) {
160
-        /**
161
-         * @ignore
162
-         */
163
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
164
-            LoggerOptionConverter::toBoolean($GLOBALS['log4php.defaultInitOverride'], false)
165
-        );
166
-    } else {
167
-        /**
168
-         * Controls init execution
169
-         *
170
-         * With this constant users can skip the default init procedure that is
171
-         * called when this file is included.
172
-         *
173
-         * <p>If it is not user defined, log4php tries to autoconfigure using (in order):</p>
174
-         *
175
-         * - the <code>$_ENV['log4php.defaultInitOverride']</code> variable.
176
-         * - the <code>$GLOBALS['log4php.defaultInitOverride']</code> global variable.
177
-         * - defaults to <i>false</i>
178
-         *
179
-         * @var boolean
180
-         */
181
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', false);
182
-    }
152
+	if (isset($_ENV['log4php.defaultInitOverride'])) {
153
+		/**
154
+		 * @ignore
155
+		 */
156
+		define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
157
+			LoggerOptionConverter::toBoolean($_ENV['log4php.defaultInitOverride'], false)
158
+		);
159
+	} elseif (isset($GLOBALS['log4php.defaultInitOverride'])) {
160
+		/**
161
+		 * @ignore
162
+		 */
163
+		define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
164
+			LoggerOptionConverter::toBoolean($GLOBALS['log4php.defaultInitOverride'], false)
165
+		);
166
+	} else {
167
+		/**
168
+		 * Controls init execution
169
+		 *
170
+		 * With this constant users can skip the default init procedure that is
171
+		 * called when this file is included.
172
+		 *
173
+		 * <p>If it is not user defined, log4php tries to autoconfigure using (in order):</p>
174
+		 *
175
+		 * - the <code>$_ENV['log4php.defaultInitOverride']</code> variable.
176
+		 * - the <code>$GLOBALS['log4php.defaultInitOverride']</code> global variable.
177
+		 * - defaults to <i>false</i>
178
+		 *
179
+		 * @var boolean
180
+		 */
181
+		define('LOG4PHP_DEFAULT_INIT_OVERRIDE', false);
182
+	}
183 183
 }
184 184
 
185 185
 if (!defined('LOG4PHP_CONFIGURATION')) {
186
-    if (isset($_ENV['log4php.configuration'])) {
187
-        /**
188
-         * @ignore
189
-         */
190
-        define('LOG4PHP_CONFIGURATION', trim($_ENV['log4php.configuration']));
191
-    } else {
192
-        /**
193
-         * Configuration file.
194
-         *
195
-         * <p>This constant tells configurator classes where the configuration
196
-         * file is located.</p>
197
-         * <p>If not set by user, log4php tries to set it automatically using 
198
-         * (in order):</p>
199
-         *
200
-         * - the <code>$_ENV['log4php.configuration']</code> enviroment variable.
201
-         * - defaults to 'log4php.properties'.
202
-         *
203
-         * @var string
204
-         */
205
-        define('LOG4PHP_CONFIGURATION', 'config/log4php.properties');
206
-    }
186
+	if (isset($_ENV['log4php.configuration'])) {
187
+		/**
188
+		 * @ignore
189
+		 */
190
+		define('LOG4PHP_CONFIGURATION', trim($_ENV['log4php.configuration']));
191
+	} else {
192
+		/**
193
+		 * Configuration file.
194
+		 *
195
+		 * <p>This constant tells configurator classes where the configuration
196
+		 * file is located.</p>
197
+		 * <p>If not set by user, log4php tries to set it automatically using 
198
+		 * (in order):</p>
199
+		 *
200
+		 * - the <code>$_ENV['log4php.configuration']</code> enviroment variable.
201
+		 * - defaults to 'log4php.properties'.
202
+		 *
203
+		 * @var string
204
+		 */
205
+		define('LOG4PHP_CONFIGURATION', 'config/log4php.properties');
206
+	}
207 207
 }
208 208
 
209 209
 if (!defined('LOG4PHP_CONFIGURATOR_CLASS')) {
210
-    if ( strtolower(substr( LOG4PHP_CONFIGURATION, -4 )) == '.xml') { 
211
-        /**
212
-         * @ignore
213
-         */
214
-        define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/xml/LoggerDOMConfigurator');
215
-    } else {
216
-        /**
217
-         * Holds the configurator class name.
218
-         *
219
-         * <p>This constant is set with the fullname (path included but non the 
220
-         * .php extension) of the configurator class that init procedure will use.</p>
221
-         * <p>If not set by user, log4php tries to set it automatically.</p>
222
-         * <p>If {@link LOG4PHP_CONFIGURATION} has '.xml' extension set the 
223
-         * constants to '{@link LOG4PHP_DIR}/xml/{@link LoggerDOMConfigurator}'.</p>
224
-         * <p>Otherwise set the constants to 
225
-         * '{@link LOG4PHP_DIR}/{@link LoggerPropertyConfigurator}'.</p>
226
-         *
227
-         * <p><b>Security Note</b>: classfile pointed by this constant will be brutally
228
-         * included with a:
229
-         * <code>@include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");</code></p>
230
-         *
231
-         * @var string
232
-         */
233
-        define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/LoggerPropertyConfigurator');
234
-    }
210
+	if ( strtolower(substr( LOG4PHP_CONFIGURATION, -4 )) == '.xml') { 
211
+		/**
212
+		 * @ignore
213
+		 */
214
+		define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/xml/LoggerDOMConfigurator');
215
+	} else {
216
+		/**
217
+		 * Holds the configurator class name.
218
+		 *
219
+		 * <p>This constant is set with the fullname (path included but non the 
220
+		 * .php extension) of the configurator class that init procedure will use.</p>
221
+		 * <p>If not set by user, log4php tries to set it automatically.</p>
222
+		 * <p>If {@link LOG4PHP_CONFIGURATION} has '.xml' extension set the 
223
+		 * constants to '{@link LOG4PHP_DIR}/xml/{@link LoggerDOMConfigurator}'.</p>
224
+		 * <p>Otherwise set the constants to 
225
+		 * '{@link LOG4PHP_DIR}/{@link LoggerPropertyConfigurator}'.</p>
226
+		 *
227
+		 * <p><b>Security Note</b>: classfile pointed by this constant will be brutally
228
+		 * included with a:
229
+		 * <code>@include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");</code></p>
230
+		 *
231
+		 * @var string
232
+		 */
233
+		define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/LoggerPropertyConfigurator');
234
+	}
235 235
 }
236 236
 
237 237
 if (!LOG4PHP_DEFAULT_INIT_OVERRIDE) {
238
-    if (!LoggerManagerDefaultInit())
239
-        LoggerLog::warn("LOG4PHP main() Default Init failed.");
238
+	if (!LoggerManagerDefaultInit())
239
+		LoggerLog::warn("LOG4PHP main() Default Init failed.");
240 240
 }
241 241
 
242 242
 /**
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function LoggerManagerDefaultInit()
255 255
 {
256
-    $configuratorClass = basename(LOG4PHP_CONFIGURATOR_CLASS);
257
-    if (!class_exists($configuratorClass)) {
258
-        @include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");
259
-    }
260
-    if (class_exists($configuratorClass)) {
256
+	$configuratorClass = basename(LOG4PHP_CONFIGURATOR_CLASS);
257
+	if (!class_exists($configuratorClass)) {
258
+		@include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");
259
+	}
260
+	if (class_exists($configuratorClass)) {
261 261
         
262
-        return call_user_func(array($configuratorClass, 'configure'), LOG4PHP_CONFIGURATION);         
262
+		return call_user_func(array($configuratorClass, 'configure'), LOG4PHP_CONFIGURATION);         
263 263
 
264
-    } else {
265
-        LoggerLog::warn("LoggerManagerDefaultInit() Configurator '{$configuratorClass}' doesnt exists");
266
-        return false;
267
-    }
264
+	} else {
265
+		LoggerLog::warn("LoggerManagerDefaultInit() Configurator '{$configuratorClass}' doesnt exists");
266
+		return false;
267
+	}
268 268
 }
Please login to merge, or discard this patch.
libraries/log4php.debug/LoggerPropertyConfigurator.php 1 patch
Indentation   +521 added lines, -521 removed lines patch added patch discarded remove patch
@@ -91,560 +91,560 @@
 block discarded – undo
91 91
  */
92 92
 class LoggerPropertyConfigurator extends LoggerConfigurator {
93 93
 
94
-    /**
95
-     * @var LoggerFactory
96
-     */
97
-    var $loggerFactory = null;
94
+	/**
95
+	 * @var LoggerFactory
96
+	 */
97
+	var $loggerFactory = null;
98 98
     
99
-    /**
100
-     * Constructor
101
-     */
102
-    public function LoggerPropertyConfigurator()
103
-    {
104
-        $this->loggerFactory = new LoggerDefaultCategoryFactory();
105
-    }
99
+	/**
100
+	 * Constructor
101
+	 */
102
+	public function LoggerPropertyConfigurator()
103
+	{
104
+		$this->loggerFactory = new LoggerDefaultCategoryFactory();
105
+	}
106 106
     
107
-    /**
108
-     * Configure the default repository using the resource pointed by <b>url</b>.
109
-     * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function.
110
-     * Note that the resource will be search with <i>use_include_path</i> parameter 
111
-     * set to "1".
112
-     *
113
-     * @param string $url
114
-     * @return boolean configuration result
115
-     * @static
116
-     */
117
-    public function configure($url = '')
118
-    {
119
-        $configurator = new LoggerPropertyConfigurator();
120
-        $repository =& LoggerManager::getLoggerRepository();
121
-        return $configurator->doConfigure($url, $repository);
122
-    }
107
+	/**
108
+	 * Configure the default repository using the resource pointed by <b>url</b>.
109
+	 * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function.
110
+	 * Note that the resource will be search with <i>use_include_path</i> parameter 
111
+	 * set to "1".
112
+	 *
113
+	 * @param string $url
114
+	 * @return boolean configuration result
115
+	 * @static
116
+	 */
117
+	public function configure($url = '')
118
+	{
119
+		$configurator = new LoggerPropertyConfigurator();
120
+		$repository =& LoggerManager::getLoggerRepository();
121
+		return $configurator->doConfigure($url, $repository);
122
+	}
123 123
 
124
-    /**
125
-     * Read configuration from a file.
126
-     *
127
-     * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
128
-     * file.</p>
129
-     *
130
-     * <b>The existing configuration is not cleared nor reset.</b> 
131
-     * If you require a different behavior, then call 
132
-     * {@link  LoggerManager::resetConfiguration()} 
133
-     * method before calling {@link doConfigure()}.
134
-     * 
135
-     * <p>The configuration file consists of statements in the format
136
-     * <b>key=value</b>. The syntax of different configuration
137
-     * elements are discussed below.
138
-     * 
139
-     * <p><b>Repository-wide threshold</b></p>
140
-     * 
141
-     * <p>The repository-wide threshold filters logging requests by level
142
-     * regardless of logger. The syntax is:
143
-     * 
144
-     * <pre>
145
-     * log4php.threshold=[level]
146
-     * </pre>
147
-     * 
148
-     * <p>The level value can consist of the string values OFF, FATAL,
149
-     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
150
-     * custom level value can be specified in the form
151
-     * <samp>level#classname</samp>. By default the repository-wide threshold is set
152
-     * to the lowest possible value, namely the level <b>ALL</b>.
153
-     * </p>
154
-     * 
155
-     * 
156
-     * <p><b>Appender configuration</b></p>
157
-     * 
158
-     * <p>Appender configuration syntax is:</p>
159
-     * <pre>
160
-     * ; For appender named <i>appenderName</i>, set its class.
161
-     * ; Note: The appender name can contain dots.
162
-     * log4php.appender.appenderName=name_of_appender_class
163
-     * 
164
-     * ; Set appender specific options.
165
-     * 
166
-     * log4php.appender.appenderName.option1=value1
167
-     * log4php.appender.appenderName.optionN=valueN
168
-     * </pre>
169
-     * 
170
-     * For each named appender you can configure its {@link LoggerLayout}. The
171
-     * syntax for configuring an appender's layout is:
172
-     * <pre>
173
-     * log4php.appender.appenderName.layout=name_of_layout_class
174
-     * log4php.appender.appenderName.layout.option1=value1
175
-     *  ....
176
-     * log4php.appender.appenderName.layout.optionN=valueN
177
-     * </pre>
178
-     * 
179
-     * <p><b>Configuring loggers</b></p>
180
-     * 
181
-     * <p>The syntax for configuring the root logger is:
182
-     * <pre>
183
-     * log4php.rootLogger=[level], appenderName, appenderName, ...
184
-     * </pre>
185
-     * 
186
-     * <p>This syntax means that an optional <i>level</i> can be
187
-     * supplied followed by appender names separated by commas.
188
-     * 
189
-     * <p>The level value can consist of the string values OFF, FATAL,
190
-     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
191
-     * custom level value can be specified in the form</p>
192
-     *
193
-     * <pre>level#classname</pre>
194
-     * 
195
-     * <p>If a level value is specified, then the root level is set
196
-     * to the corresponding level.  If no level value is specified,
197
-     * then the root level remains untouched.
198
-     * 
199
-     * <p>The root logger can be assigned multiple appenders.
200
-     * 
201
-     * <p>Each <i>appenderName</i> (separated by commas) will be added to
202
-     * the root logger. The named appender is defined using the
203
-     * appender syntax defined above.
204
-     * 
205
-     * <p>For non-root categories the syntax is almost the same:
206
-     * <pre>
207
-     * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
208
-     * </pre>
209
-     * 
210
-     * <p>The meaning of the optional level value is discussed above
211
-     * in relation to the root logger. In addition however, the value
212
-     * INHERITED can be specified meaning that the named logger should
213
-     * inherit its level from the logger hierarchy.</p>
214
-     * 
215
-     * <p>If no level value is supplied, then the level of the
216
-     * named logger remains untouched.</p>
217
-     * 
218
-     * <p>By default categories inherit their level from the
219
-     * hierarchy. However, if you set the level of a logger and later
220
-     * decide that that logger should inherit its level, then you should
221
-     * specify INHERITED as the value for the level value. NULL is a
222
-     * synonym for INHERITED.</p>
223
-     * 
224
-     * <p>Similar to the root logger syntax, each <i>appenderName</i>
225
-     * (separated by commas) will be attached to the named logger.</p>
226
-     * 
227
-     * <p>See the <i>appender additivity rule</i> in the user manual for 
228
-     * the meaning of the <b>additivity</b> flag.
229
-     * 
230
-     * <p><b>ObjectRenderers</b></p>
231
-     * 
232
-     * <p>You can customize the way message objects of a given type are
233
-     * converted to String before being logged. This is done by
234
-     * specifying a {@link LoggerObjectRenderer}
235
-     * for the object type would like to customize.</p>
236
-     * 
237
-     * <p>The syntax is:
238
-     * 
239
-     * <pre>
240
-     * log4php.renderer.name_of_rendered_class=name_of_rendering.class
241
-     * </pre>
242
-     * 
243
-     * As in,
244
-     * <pre>
245
-     * log4php.renderer.myFruit=myFruitRenderer
246
-     * </pre>
247
-     * 
248
-     * <p><b>Logger Factories</b></p>
249
-     * 
250
-     * The usage of custom logger factories is discouraged and no longer
251
-     * documented.
252
-     * 
253
-     * <p><b>Example</b></p>
254
-     * 
255
-     * <p>An example configuration is given below. Other configuration
256
-     * file examples are given in the <b>tests</b> folder.
257
-     * 
258
-     * <pre>
259
-     * ; Set options for appender named "A1".
260
-     * ; Appender "A1" will be a SyslogAppender
261
-     * log4php.appender.A1=SyslogAppender
262
-     * 
263
-     * ; The syslog daemon resides on www.abc.net
264
-     * log4php.appender.A1.SyslogHost=www.abc.net
265
-     * 
266
-     * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
267
-     * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
268
-     * ; include the relative time since the start of the application in
269
-     * ; milliseconds, followed by the level of the log request,
270
-     * ; followed by the two rightmost components of the logger name,
271
-     * ; followed by the callers method name, followed by the line number,
272
-     * ; the nested disgnostic context and finally the message itself.
273
-     * ; Refer to the documentation of LoggerPatternLayout} for further information
274
-     * ; on the syntax of the ConversionPattern key.
275
-     * log4php.appender.A1.layout=LoggerPatternLayout
276
-     * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
277
-     * 
278
-     * ; Set options for appender named "A2"
279
-     * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
280
-     * ; using at most one backup file. A2's layout is TTCC, using the
281
-     * ; ISO8061 date format with context printing enabled.
282
-     * log4php.appender.A2=LoggerAppenderRollingFile
283
-     * log4php.appender.A2.MaxFileSize=10MB
284
-     * log4php.appender.A2.MaxBackupIndex=1
285
-     * log4php.appender.A2.layout=LoggerLayoutTTCC
286
-     * log4php.appender.A2.layout.ContextPrinting="true"
287
-     * log4php.appender.A2.layout.DateFormat="%c"
288
-     * 
289
-     * ; Root logger set to DEBUG using the A2 appender defined above.
290
-     * log4php.rootLogger=DEBUG, A2
291
-     * 
292
-     * ; Logger definitions:
293
-     * ; The SECURITY logger inherits is level from root. However, it's output
294
-     * ; will go to A1 appender defined above. It's additivity is non-cumulative.
295
-     * log4php.logger.SECURITY=INHERIT, A1
296
-     * log4php.additivity.SECURITY=false
297
-     * 
298
-     * ; Only warnings or above will be logged for the logger "SECURITY.access".
299
-     * ; Output will go to A1.
300
-     * log4php.logger.SECURITY.access=WARN
301
-     * 
302
-     * 
303
-     * ; The logger "class.of.the.day" inherits its level from the
304
-     * ; logger hierarchy.  Output will go to the appender's of the root
305
-     * ; logger, A2 in this case.
306
-     * log4php.logger.class.of.the.day=INHERIT
307
-     * </pre>
308
-     * 
309
-     * <p>Refer to the <b>setOption</b> method in each Appender and
310
-     * Layout for class specific options.</p>
311
-     * 
312
-     * <p>Use the <b>&quot;;&quot;</b> character at the
313
-     * beginning of a line for comments.</p>
314
-     * 
315
-     * @param string $url The name of the configuration file where the
316
-     *                    configuration information is stored.
317
-     * @param LoggerHierarchy &$repository the repository to apply the configuration
318
-     */
319
-    public function doConfigure($url, &$repository)
320
-    {
321
-        $properties = @parse_ini_file($url);
322
-        if ($properties === false) {
323
-            LoggerLog::warn("LoggerPropertyConfigurator::doConfigure() cannot load '$url' configuration.");
324
-            return false; 
325
-        }
326
-        return $this->doConfigureProperties($properties, $repository);
327
-    }
124
+	/**
125
+	 * Read configuration from a file.
126
+	 *
127
+	 * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
128
+	 * file.</p>
129
+	 *
130
+	 * <b>The existing configuration is not cleared nor reset.</b> 
131
+	 * If you require a different behavior, then call 
132
+	 * {@link  LoggerManager::resetConfiguration()} 
133
+	 * method before calling {@link doConfigure()}.
134
+	 * 
135
+	 * <p>The configuration file consists of statements in the format
136
+	 * <b>key=value</b>. The syntax of different configuration
137
+	 * elements are discussed below.
138
+	 * 
139
+	 * <p><b>Repository-wide threshold</b></p>
140
+	 * 
141
+	 * <p>The repository-wide threshold filters logging requests by level
142
+	 * regardless of logger. The syntax is:
143
+	 * 
144
+	 * <pre>
145
+	 * log4php.threshold=[level]
146
+	 * </pre>
147
+	 * 
148
+	 * <p>The level value can consist of the string values OFF, FATAL,
149
+	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
150
+	 * custom level value can be specified in the form
151
+	 * <samp>level#classname</samp>. By default the repository-wide threshold is set
152
+	 * to the lowest possible value, namely the level <b>ALL</b>.
153
+	 * </p>
154
+	 * 
155
+	 * 
156
+	 * <p><b>Appender configuration</b></p>
157
+	 * 
158
+	 * <p>Appender configuration syntax is:</p>
159
+	 * <pre>
160
+	 * ; For appender named <i>appenderName</i>, set its class.
161
+	 * ; Note: The appender name can contain dots.
162
+	 * log4php.appender.appenderName=name_of_appender_class
163
+	 * 
164
+	 * ; Set appender specific options.
165
+	 * 
166
+	 * log4php.appender.appenderName.option1=value1
167
+	 * log4php.appender.appenderName.optionN=valueN
168
+	 * </pre>
169
+	 * 
170
+	 * For each named appender you can configure its {@link LoggerLayout}. The
171
+	 * syntax for configuring an appender's layout is:
172
+	 * <pre>
173
+	 * log4php.appender.appenderName.layout=name_of_layout_class
174
+	 * log4php.appender.appenderName.layout.option1=value1
175
+	 *  ....
176
+	 * log4php.appender.appenderName.layout.optionN=valueN
177
+	 * </pre>
178
+	 * 
179
+	 * <p><b>Configuring loggers</b></p>
180
+	 * 
181
+	 * <p>The syntax for configuring the root logger is:
182
+	 * <pre>
183
+	 * log4php.rootLogger=[level], appenderName, appenderName, ...
184
+	 * </pre>
185
+	 * 
186
+	 * <p>This syntax means that an optional <i>level</i> can be
187
+	 * supplied followed by appender names separated by commas.
188
+	 * 
189
+	 * <p>The level value can consist of the string values OFF, FATAL,
190
+	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
191
+	 * custom level value can be specified in the form</p>
192
+	 *
193
+	 * <pre>level#classname</pre>
194
+	 * 
195
+	 * <p>If a level value is specified, then the root level is set
196
+	 * to the corresponding level.  If no level value is specified,
197
+	 * then the root level remains untouched.
198
+	 * 
199
+	 * <p>The root logger can be assigned multiple appenders.
200
+	 * 
201
+	 * <p>Each <i>appenderName</i> (separated by commas) will be added to
202
+	 * the root logger. The named appender is defined using the
203
+	 * appender syntax defined above.
204
+	 * 
205
+	 * <p>For non-root categories the syntax is almost the same:
206
+	 * <pre>
207
+	 * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
208
+	 * </pre>
209
+	 * 
210
+	 * <p>The meaning of the optional level value is discussed above
211
+	 * in relation to the root logger. In addition however, the value
212
+	 * INHERITED can be specified meaning that the named logger should
213
+	 * inherit its level from the logger hierarchy.</p>
214
+	 * 
215
+	 * <p>If no level value is supplied, then the level of the
216
+	 * named logger remains untouched.</p>
217
+	 * 
218
+	 * <p>By default categories inherit their level from the
219
+	 * hierarchy. However, if you set the level of a logger and later
220
+	 * decide that that logger should inherit its level, then you should
221
+	 * specify INHERITED as the value for the level value. NULL is a
222
+	 * synonym for INHERITED.</p>
223
+	 * 
224
+	 * <p>Similar to the root logger syntax, each <i>appenderName</i>
225
+	 * (separated by commas) will be attached to the named logger.</p>
226
+	 * 
227
+	 * <p>See the <i>appender additivity rule</i> in the user manual for 
228
+	 * the meaning of the <b>additivity</b> flag.
229
+	 * 
230
+	 * <p><b>ObjectRenderers</b></p>
231
+	 * 
232
+	 * <p>You can customize the way message objects of a given type are
233
+	 * converted to String before being logged. This is done by
234
+	 * specifying a {@link LoggerObjectRenderer}
235
+	 * for the object type would like to customize.</p>
236
+	 * 
237
+	 * <p>The syntax is:
238
+	 * 
239
+	 * <pre>
240
+	 * log4php.renderer.name_of_rendered_class=name_of_rendering.class
241
+	 * </pre>
242
+	 * 
243
+	 * As in,
244
+	 * <pre>
245
+	 * log4php.renderer.myFruit=myFruitRenderer
246
+	 * </pre>
247
+	 * 
248
+	 * <p><b>Logger Factories</b></p>
249
+	 * 
250
+	 * The usage of custom logger factories is discouraged and no longer
251
+	 * documented.
252
+	 * 
253
+	 * <p><b>Example</b></p>
254
+	 * 
255
+	 * <p>An example configuration is given below. Other configuration
256
+	 * file examples are given in the <b>tests</b> folder.
257
+	 * 
258
+	 * <pre>
259
+	 * ; Set options for appender named "A1".
260
+	 * ; Appender "A1" will be a SyslogAppender
261
+	 * log4php.appender.A1=SyslogAppender
262
+	 * 
263
+	 * ; The syslog daemon resides on www.abc.net
264
+	 * log4php.appender.A1.SyslogHost=www.abc.net
265
+	 * 
266
+	 * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
267
+	 * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
268
+	 * ; include the relative time since the start of the application in
269
+	 * ; milliseconds, followed by the level of the log request,
270
+	 * ; followed by the two rightmost components of the logger name,
271
+	 * ; followed by the callers method name, followed by the line number,
272
+	 * ; the nested disgnostic context and finally the message itself.
273
+	 * ; Refer to the documentation of LoggerPatternLayout} for further information
274
+	 * ; on the syntax of the ConversionPattern key.
275
+	 * log4php.appender.A1.layout=LoggerPatternLayout
276
+	 * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
277
+	 * 
278
+	 * ; Set options for appender named "A2"
279
+	 * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
280
+	 * ; using at most one backup file. A2's layout is TTCC, using the
281
+	 * ; ISO8061 date format with context printing enabled.
282
+	 * log4php.appender.A2=LoggerAppenderRollingFile
283
+	 * log4php.appender.A2.MaxFileSize=10MB
284
+	 * log4php.appender.A2.MaxBackupIndex=1
285
+	 * log4php.appender.A2.layout=LoggerLayoutTTCC
286
+	 * log4php.appender.A2.layout.ContextPrinting="true"
287
+	 * log4php.appender.A2.layout.DateFormat="%c"
288
+	 * 
289
+	 * ; Root logger set to DEBUG using the A2 appender defined above.
290
+	 * log4php.rootLogger=DEBUG, A2
291
+	 * 
292
+	 * ; Logger definitions:
293
+	 * ; The SECURITY logger inherits is level from root. However, it's output
294
+	 * ; will go to A1 appender defined above. It's additivity is non-cumulative.
295
+	 * log4php.logger.SECURITY=INHERIT, A1
296
+	 * log4php.additivity.SECURITY=false
297
+	 * 
298
+	 * ; Only warnings or above will be logged for the logger "SECURITY.access".
299
+	 * ; Output will go to A1.
300
+	 * log4php.logger.SECURITY.access=WARN
301
+	 * 
302
+	 * 
303
+	 * ; The logger "class.of.the.day" inherits its level from the
304
+	 * ; logger hierarchy.  Output will go to the appender's of the root
305
+	 * ; logger, A2 in this case.
306
+	 * log4php.logger.class.of.the.day=INHERIT
307
+	 * </pre>
308
+	 * 
309
+	 * <p>Refer to the <b>setOption</b> method in each Appender and
310
+	 * Layout for class specific options.</p>
311
+	 * 
312
+	 * <p>Use the <b>&quot;;&quot;</b> character at the
313
+	 * beginning of a line for comments.</p>
314
+	 * 
315
+	 * @param string $url The name of the configuration file where the
316
+	 *                    configuration information is stored.
317
+	 * @param LoggerHierarchy &$repository the repository to apply the configuration
318
+	 */
319
+	public function doConfigure($url, &$repository)
320
+	{
321
+		$properties = @parse_ini_file($url);
322
+		if ($properties === false) {
323
+			LoggerLog::warn("LoggerPropertyConfigurator::doConfigure() cannot load '$url' configuration.");
324
+			return false; 
325
+		}
326
+		return $this->doConfigureProperties($properties, $repository);
327
+	}
328 328
 
329 329
 
330
-    /**
331
-     * Read configuration options from <b>properties</b>.
332
-     *
333
-     * @see doConfigure().
334
-     * @param array $properties
335
-     * @param LoggerHierarchy &$hierarchy
336
-     */
337
-    public function doConfigureProperties($properties, &$hierarchy)
338
-    {
339
-        $value = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_DEBUG_KEY];
330
+	/**
331
+	 * Read configuration options from <b>properties</b>.
332
+	 *
333
+	 * @see doConfigure().
334
+	 * @param array $properties
335
+	 * @param LoggerHierarchy &$hierarchy
336
+	 */
337
+	public function doConfigureProperties($properties, &$hierarchy)
338
+	{
339
+		$value = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_DEBUG_KEY];
340 340
         
341
-        if (!empty($value)) {
342
-            LoggerLog::internalDebugging(LoggerOptionConverter::toBoolean($value, LoggerLog::internalDebugging()));
343
-        }
341
+		if (!empty($value)) {
342
+			LoggerLog::internalDebugging(LoggerOptionConverter::toBoolean($value, LoggerLog::internalDebugging()));
343
+		}
344 344
 
345
-        $thresholdStr = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX];
346
-        $hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
345
+		$thresholdStr = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX];
346
+		$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
347 347
         
348
-        $this->configureRootCategory($properties, $hierarchy);
349
-        $this->configureLoggerFactory($properties);
350
-        $this->parseCatsAndRenderers($properties, $hierarchy);
348
+		$this->configureRootCategory($properties, $hierarchy);
349
+		$this->configureLoggerFactory($properties);
350
+		$this->parseCatsAndRenderers($properties, $hierarchy);
351 351
 
352
-        LoggerLog::debug("LoggerPropertyConfigurator::doConfigureProperties() Finished configuring.");
352
+		LoggerLog::debug("LoggerPropertyConfigurator::doConfigureProperties() Finished configuring.");
353 353
         
354
-        return true;
355
-    }
354
+		return true;
355
+	}
356 356
 
357
-    // --------------------------------------------------------------------------
358
-    // Internal stuff
359
-    // --------------------------------------------------------------------------
357
+	// --------------------------------------------------------------------------
358
+	// Internal stuff
359
+	// --------------------------------------------------------------------------
360 360
 
361
-    /**
362
-     * Check the provided <b>Properties</b> object for a
363
-     * {@link LoggerFactory} entry specified by 
364
-     * {@link LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY}.
365
-     *  
366
-     * If such an entry exists, an attempt is made to create an instance using 
367
-     * the default constructor.  
368
-     * This instance is used for subsequent Category creations
369
-     * within this configurator.
370
-     *
371
-     * @see parseCatsAndRenderers()
372
-     * @param array $props array of properties
373
-     */
374
-    public function configureLoggerFactory($props)
375
-    {
376
-        $factoryFqcn = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY];
377
-        if(!empty($factoryFqcn)) {
378
-            $factoryClassName = basename($factoryFqcn);
379
-            LoggerLog::debug(
380
-                "LoggerPropertyConfigurator::configureLoggerFactory() Trying to load factory [" .
381
-                $factoryClassName . 
382
-                "]."
383
-            );
361
+	/**
362
+	 * Check the provided <b>Properties</b> object for a
363
+	 * {@link LoggerFactory} entry specified by 
364
+	 * {@link LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY}.
365
+	 *  
366
+	 * If such an entry exists, an attempt is made to create an instance using 
367
+	 * the default constructor.  
368
+	 * This instance is used for subsequent Category creations
369
+	 * within this configurator.
370
+	 *
371
+	 * @see parseCatsAndRenderers()
372
+	 * @param array $props array of properties
373
+	 */
374
+	public function configureLoggerFactory($props)
375
+	{
376
+		$factoryFqcn = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY];
377
+		if(!empty($factoryFqcn)) {
378
+			$factoryClassName = basename($factoryFqcn);
379
+			LoggerLog::debug(
380
+				"LoggerPropertyConfigurator::configureLoggerFactory() Trying to load factory [" .
381
+				$factoryClassName . 
382
+				"]."
383
+			);
384 384
             
385
-            if (!class_exists($factoryClassName))
386
-                @include_once("{$factoryFqcn}.php");
387
-            if (class_exists($factoryClassName)) {
388
-                $loggerFactory = new $factoryClassName();
389
-            } else {
390
-                LoggerLog::debug(
391
-                    "LoggerPropertyConfigurator::configureLoggerFactory() Unable to load factory [" .
392
-                    $factoryClassName . 
393
-                    "]. Using default."
394
-                );
395
-                $loggerFactory = $this->loggerFactory;
396
-            }
385
+			if (!class_exists($factoryClassName))
386
+				@include_once("{$factoryFqcn}.php");
387
+			if (class_exists($factoryClassName)) {
388
+				$loggerFactory = new $factoryClassName();
389
+			} else {
390
+				LoggerLog::debug(
391
+					"LoggerPropertyConfigurator::configureLoggerFactory() Unable to load factory [" .
392
+					$factoryClassName . 
393
+					"]. Using default."
394
+				);
395
+				$loggerFactory = $this->loggerFactory;
396
+			}
397 397
 
398
-            LoggerLog::debug(
399
-                "LoggerPropertyConfigurator::configureLoggerFactory() ".
400
-                "Setting properties for category factory [" . get_class($loggerFactory) . "]."
401
-            );
398
+			LoggerLog::debug(
399
+				"LoggerPropertyConfigurator::configureLoggerFactory() ".
400
+				"Setting properties for category factory [" . get_class($loggerFactory) . "]."
401
+			);
402 402
             
403
-            LoggerPropertySetter::setPropertiesByObject($loggerFactory, $props, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_FACTORY_PREFIX . ".");
404
-        }
405
-    }
403
+			LoggerPropertySetter::setPropertiesByObject($loggerFactory, $props, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_FACTORY_PREFIX . ".");
404
+		}
405
+	}
406 406
     
407
-    /**
408
-     * @param array $props array of properties
409
-     * @param LoggerHierarchy &$hierarchy
410
-     */
411
-    public function configureRootCategory($props, &$hierarchy)
412
-    {
413
-        $effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX;
414
-        $value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX];
407
+	/**
408
+	 * @param array $props array of properties
409
+	 * @param LoggerHierarchy &$hierarchy
410
+	 */
411
+	public function configureRootCategory($props, &$hierarchy)
412
+	{
413
+		$effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX;
414
+		$value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX];
415 415
 
416
-        if(empty($value)) {
417
-            $value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX];
418
-            $effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX;
419
-        }
416
+		if(empty($value)) {
417
+			$value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX];
418
+			$effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX;
419
+		}
420 420
 
421
-        if (empty($value)) {
422
-            LoggerLog::debug(
423
-                "LoggerPropertyConfigurator::configureRootCategory() ".
424
-                "Could not find root logger information. Is this OK?"
425
-            );
426
-        } else {
427
-            $root =& $hierarchy->getRootLogger();
428
-            // synchronized(root) {
429
-        	$this->parseCategory(
430
-                $props, 
431
-                $root, 
432
-                $effectivePrefix, 
433
-                LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME, 
434
-                $value
435
-            );
436
-            // }
437
-        }
438
-    }
421
+		if (empty($value)) {
422
+			LoggerLog::debug(
423
+				"LoggerPropertyConfigurator::configureRootCategory() ".
424
+				"Could not find root logger information. Is this OK?"
425
+			);
426
+		} else {
427
+			$root =& $hierarchy->getRootLogger();
428
+			// synchronized(root) {
429
+			$this->parseCategory(
430
+				$props, 
431
+				$root, 
432
+				$effectivePrefix, 
433
+				LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME, 
434
+				$value
435
+			);
436
+			// }
437
+		}
438
+	}
439 439
 
440
-    /**
441
-     * Parse non-root elements, such non-root categories and renderers.
442
-     *
443
-     * @param array $props array of properties
444
-     * @param LoggerHierarchy &$hierarchy
445
-     */
446
-    public function parseCatsAndRenderers($props, &$hierarchy)
447
-    {
448
-        while(list($key,$value) = each($props)) {
449
-            if( strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0 || 
450
-                strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
451
-	            if(strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0) {
452
-                    $loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX));
453
-	            } elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
454
-                    $loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX));
455
-                }
456
-                $logger =& $hierarchy->getLogger($loggerName, $this->loggerFactory);
457
-	            // synchronized(logger) {
458
-	            $this->parseCategory($props, $logger, $key, $loggerName, $value);
459
-        	    $this->parseAdditivityForLogger($props, $logger, $loggerName);
460
-	            // }
461
-            } elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX) === 0) {
462
-                $renderedClass = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX));
463
-	            $renderingClass = $value;
464
-            	if (method_exists($hierarchy, 'addrenderer')) {
465
-	                LoggerRendererMap::addRenderer($hierarchy, $renderedClass, $renderingClass);
466
-                }
467
-	        }
468
-        }
469
-    }
440
+	/**
441
+	 * Parse non-root elements, such non-root categories and renderers.
442
+	 *
443
+	 * @param array $props array of properties
444
+	 * @param LoggerHierarchy &$hierarchy
445
+	 */
446
+	public function parseCatsAndRenderers($props, &$hierarchy)
447
+	{
448
+		while(list($key,$value) = each($props)) {
449
+			if( strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0 || 
450
+				strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
451
+				if(strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0) {
452
+					$loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX));
453
+				} elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
454
+					$loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX));
455
+				}
456
+				$logger =& $hierarchy->getLogger($loggerName, $this->loggerFactory);
457
+				// synchronized(logger) {
458
+				$this->parseCategory($props, $logger, $key, $loggerName, $value);
459
+				$this->parseAdditivityForLogger($props, $logger, $loggerName);
460
+				// }
461
+			} elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX) === 0) {
462
+				$renderedClass = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX));
463
+				$renderingClass = $value;
464
+				if (method_exists($hierarchy, 'addrenderer')) {
465
+					LoggerRendererMap::addRenderer($hierarchy, $renderedClass, $renderingClass);
466
+				}
467
+			}
468
+		}
469
+	}
470 470
 
471
-    /**
472
-     * Parse the additivity option for a non-root category.
473
-     *
474
-     * @param array $props array of properties
475
-     * @param Logger &$cat
476
-     * @param string $loggerName
477
-     */
478
-    public function parseAdditivityForLogger($props, &$cat, $loggerName)
479
-    {
480
-        $value = LoggerOptionConverter::findAndSubst(
481
-                    LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName,
471
+	/**
472
+	 * Parse the additivity option for a non-root category.
473
+	 *
474
+	 * @param array $props array of properties
475
+	 * @param Logger &$cat
476
+	 * @param string $loggerName
477
+	 */
478
+	public function parseAdditivityForLogger($props, &$cat, $loggerName)
479
+	{
480
+		$value = LoggerOptionConverter::findAndSubst(
481
+					LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName,
482 482
 					$props
483
-                 );
484
-        LoggerLog::debug(
485
-            "LoggerPropertyConfigurator::parseAdditivityForLogger() ".
486
-            "Handling " . LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName . "=[{$value}]"
487
-        );
488
-        // touch additivity only if necessary
489
-        if(!empty($value)) {
490
-            $additivity = LoggerOptionConverter::toBoolean($value, true);
491
-            LoggerLog::debug(
492
-                "LoggerPropertyConfigurator::parseAdditivityForLogger() ".
493
-                "Setting additivity for [{$loggerName}] to [{$additivity}]"
494
-            );
495
-            $cat->setAdditivity($additivity);
496
-        }
497
-    }
483
+				 );
484
+		LoggerLog::debug(
485
+			"LoggerPropertyConfigurator::parseAdditivityForLogger() ".
486
+			"Handling " . LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName . "=[{$value}]"
487
+		);
488
+		// touch additivity only if necessary
489
+		if(!empty($value)) {
490
+			$additivity = LoggerOptionConverter::toBoolean($value, true);
491
+			LoggerLog::debug(
492
+				"LoggerPropertyConfigurator::parseAdditivityForLogger() ".
493
+				"Setting additivity for [{$loggerName}] to [{$additivity}]"
494
+			);
495
+			$cat->setAdditivity($additivity);
496
+		}
497
+	}
498 498
 
499
-    /**
500
-     * This method must work for the root category as well.
501
-     *
502
-     * @param array $props array of properties
503
-     * @param Logger &$logger
504
-     * @param string $optionKey
505
-     * @param string $loggerName
506
-     * @param string $value
507
-     * @return Logger
508
-     */
509
-    public function &parseCategory($props, &$logger, $optionKey, $loggerName, $value)
510
-    {
511
-        LoggerLog::debug(
512
-            "LoggerPropertyConfigurator::parseCategory() ".
513
-            "Parsing for [{$loggerName}] with value=[{$value}]."
514
-        );
499
+	/**
500
+	 * This method must work for the root category as well.
501
+	 *
502
+	 * @param array $props array of properties
503
+	 * @param Logger &$logger
504
+	 * @param string $optionKey
505
+	 * @param string $loggerName
506
+	 * @param string $value
507
+	 * @return Logger
508
+	 */
509
+	public function &parseCategory($props, &$logger, $optionKey, $loggerName, $value)
510
+	{
511
+		LoggerLog::debug(
512
+			"LoggerPropertyConfigurator::parseCategory() ".
513
+			"Parsing for [{$loggerName}] with value=[{$value}]."
514
+		);
515 515
         
516
-        // We must skip over ',' but not white space
517
-        $st = explode(',', $value);
516
+		// We must skip over ',' but not white space
517
+		$st = explode(',', $value);
518 518
 
519
-        // If value is not in the form ", appender.." or "", then we should set
520
-        // the level of the loggeregory.
519
+		// If value is not in the form ", appender.." or "", then we should set
520
+		// the level of the loggeregory.
521 521
 
522
-        if(!(@$value{0} == ',' || empty($value))) {
523
-            // just to be on the safe side...
524
-            if(sizeof($st) == 0)
525
-	            return;
522
+		if(!(@$value{0} == ',' || empty($value))) {
523
+			// just to be on the safe side...
524
+			if(sizeof($st) == 0)
525
+				return;
526 526
                 
527
-            $levelStr = current($st);
528
-            LoggerLog::debug(
529
-                "LoggerPropertyConfigurator::parseCategory() ".
530
-                "Level token is [$levelStr]."
531
-            );
527
+			$levelStr = current($st);
528
+			LoggerLog::debug(
529
+				"LoggerPropertyConfigurator::parseCategory() ".
530
+				"Level token is [$levelStr]."
531
+			);
532 532
 
533
-            // If the level value is inherited, set category level value to
534
-            // null. We also check that the user has not specified inherited for the
535
-            // root category.
536
-            if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
537
-        	    if ($loggerName == LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME) {
538
-                    LoggerLog::warn(
539
-                        "LoggerPropertyConfigurator::parseCategory() ".
540
-                        "The root logger cannot be set to null."
541
-                    );
542
-	            } else {
543
-	                $logger->setLevel(null);
544
-	            }
545
-            } else {
546
-	            $logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
547
-            }
548
-        }
533
+			// If the level value is inherited, set category level value to
534
+			// null. We also check that the user has not specified inherited for the
535
+			// root category.
536
+			if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
537
+				if ($loggerName == LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME) {
538
+					LoggerLog::warn(
539
+						"LoggerPropertyConfigurator::parseCategory() ".
540
+						"The root logger cannot be set to null."
541
+					);
542
+				} else {
543
+					$logger->setLevel(null);
544
+				}
545
+			} else {
546
+				$logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
547
+			}
548
+		}
549 549
 
550
-        // Begin by removing all existing appenders.
551
-        $logger->removeAllAppenders();
552
-        while($appenderName = next($st)) {
553
-            $appenderName = trim($appenderName);
554
-            if(empty($appenderName))
555
-                continue;
556
-            LoggerLog::debug(
557
-                "LoggerPropertyConfigurator::parseCategory() ".
558
-                "Parsing appender named [{$appenderName}]."
559
-            );
560
-            $appender =& $this->parseAppender($props, $appenderName);
561
-            if($appender !== null) {
562
-	            $logger->addAppender($appender);
563
-            }
564
-        }
565
-    }
550
+		// Begin by removing all existing appenders.
551
+		$logger->removeAllAppenders();
552
+		while($appenderName = next($st)) {
553
+			$appenderName = trim($appenderName);
554
+			if(empty($appenderName))
555
+				continue;
556
+			LoggerLog::debug(
557
+				"LoggerPropertyConfigurator::parseCategory() ".
558
+				"Parsing appender named [{$appenderName}]."
559
+			);
560
+			$appender =& $this->parseAppender($props, $appenderName);
561
+			if($appender !== null) {
562
+				$logger->addAppender($appender);
563
+			}
564
+		}
565
+	}
566 566
 
567
-    /**
568
-     * @param array $props array of properties
569
-     * @param string $appenderName
570
-     * @return LoggerAppender
571
-     */
572
-    public function &parseAppender($props, $appenderName)
573
-    {
574
-        $appender =& LoggerAppender::singleton($appenderName);
575
-        if($appender !== null) {
576
-            LoggerLog::debug(
577
-                "LoggerPropertyConfigurator::parseAppender() ".
578
-                "Appender [{$appenderName}] was already parsed."
579
-            );
580
-            return $appender;
581
-        }
582
-        // Appender was not previously initialized.
583
-        $prefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX . $appenderName;
584
-        $layoutPrefix = $prefix . ".layout";
585
-        $appenderClass = @$props[$prefix];
586
-        if (!empty($appenderClass)) {
587
-            $appender =& LoggerAppender::singleton($appenderName, $appenderClass);
588
-            if($appender === null) {
589
-                LoggerLog::warn(
590
-                    "LoggerPropertyConfigurator::parseAppender() ".
591
-                    "Could not instantiate appender named [$appenderName]."
592
-                );
593
-                return null;
594
-            }
595
-        } else {
596
-            LoggerLog::warn(
597
-                "LoggerPropertyConfigurator::parseAppender() ".
598
-                "Could not instantiate appender named [$appenderName] with null className."
599
-            );
600
-            return null;
601
-        }
567
+	/**
568
+	 * @param array $props array of properties
569
+	 * @param string $appenderName
570
+	 * @return LoggerAppender
571
+	 */
572
+	public function &parseAppender($props, $appenderName)
573
+	{
574
+		$appender =& LoggerAppender::singleton($appenderName);
575
+		if($appender !== null) {
576
+			LoggerLog::debug(
577
+				"LoggerPropertyConfigurator::parseAppender() ".
578
+				"Appender [{$appenderName}] was already parsed."
579
+			);
580
+			return $appender;
581
+		}
582
+		// Appender was not previously initialized.
583
+		$prefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX . $appenderName;
584
+		$layoutPrefix = $prefix . ".layout";
585
+		$appenderClass = @$props[$prefix];
586
+		if (!empty($appenderClass)) {
587
+			$appender =& LoggerAppender::singleton($appenderName, $appenderClass);
588
+			if($appender === null) {
589
+				LoggerLog::warn(
590
+					"LoggerPropertyConfigurator::parseAppender() ".
591
+					"Could not instantiate appender named [$appenderName]."
592
+				);
593
+				return null;
594
+			}
595
+		} else {
596
+			LoggerLog::warn(
597
+				"LoggerPropertyConfigurator::parseAppender() ".
598
+				"Could not instantiate appender named [$appenderName] with null className."
599
+			);
600
+			return null;
601
+		}
602 602
         
603
-        $appender->setName($appenderName);
604
-        if( $appender->requiresLayout() ) {
605
-            LoggerLog::debug(
606
-                "LoggerPropertyConfigurator::parseAppender() ".
607
-                "Parsing layout section for [$appenderName]."
608
-            );
609
-            $layoutClass = @$props[$layoutPrefix];
610
-            $layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
611
-            if (empty($layoutClass)) {
612
-                LoggerLog::warn(
613
-                    "LoggerPropertyConfigurator::parseAppender() ".
614
-                    "layout class is empty in '$layoutPrefix'. Using Simple layout"
615
-                );
616
-                $layout = LoggerLayout::factory('LoggerLayoutSimple');
617
-            } else {
618
-        	    $layout = LoggerLayout::factory($layoutClass);
603
+		$appender->setName($appenderName);
604
+		if( $appender->requiresLayout() ) {
605
+			LoggerLog::debug(
606
+				"LoggerPropertyConfigurator::parseAppender() ".
607
+				"Parsing layout section for [$appenderName]."
608
+			);
609
+			$layoutClass = @$props[$layoutPrefix];
610
+			$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
611
+			if (empty($layoutClass)) {
612
+				LoggerLog::warn(
613
+					"LoggerPropertyConfigurator::parseAppender() ".
614
+					"layout class is empty in '$layoutPrefix'. Using Simple layout"
615
+				);
616
+				$layout = LoggerLayout::factory('LoggerLayoutSimple');
617
+			} else {
618
+				$layout = LoggerLayout::factory($layoutClass);
619 619
                 
620
-	            if($layout === null) {
621
-	                LoggerLog::warn(
622
-                        "LoggerPropertyConfigurator::parseAppender() ".
623
-                        "cannot create layout '$layoutClass'. Using Simple layout"
624
-                    );
625
-                    $layout = LoggerLayout::factory('LoggerLayoutSimple');
626
-                }
627
-            }
620
+				if($layout === null) {
621
+					LoggerLog::warn(
622
+						"LoggerPropertyConfigurator::parseAppender() ".
623
+						"cannot create layout '$layoutClass'. Using Simple layout"
624
+					);
625
+					$layout = LoggerLayout::factory('LoggerLayoutSimple');
626
+				}
627
+			}
628 628
             
629
-            LoggerLog::debug(
630
-                "LoggerPropertyConfigurator::parseAppender() ".
631
-                "Parsing layout options for [$appenderName]."
632
-            );
633
-            LoggerPropertySetter::setPropertiesByObject($layout, $props, $layoutPrefix . ".");                
634
-            LoggerLog::debug(
635
-                "LoggerPropertyConfigurator::parseAppender() ".
636
-                "End Parsing layout options for [$appenderName]."
637
-            );
638
-            $appender->setLayout($layout);
629
+			LoggerLog::debug(
630
+				"LoggerPropertyConfigurator::parseAppender() ".
631
+				"Parsing layout options for [$appenderName]."
632
+			);
633
+			LoggerPropertySetter::setPropertiesByObject($layout, $props, $layoutPrefix . ".");                
634
+			LoggerLog::debug(
635
+				"LoggerPropertyConfigurator::parseAppender() ".
636
+				"End Parsing layout options for [$appenderName]."
637
+			);
638
+			$appender->setLayout($layout);
639 639
             
640
-        }
641
-        LoggerPropertySetter::setPropertiesByObject($appender, $props, $prefix . ".");
642
-        LoggerLog::debug(
643
-            "LoggerPropertyConfigurator::parseAppender() ".        
644
-            "Parsed [{$appenderName}] options."
645
-        );
646
-        return $appender;        
647
-    }
640
+		}
641
+		LoggerPropertySetter::setPropertiesByObject($appender, $props, $prefix . ".");
642
+		LoggerLog::debug(
643
+			"LoggerPropertyConfigurator::parseAppender() ".        
644
+			"Parsed [{$appenderName}] options."
645
+		);
646
+		return $appender;        
647
+	}
648 648
 
649 649
 }
650 650
 ?>
651 651
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/LoggerNDC.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -97,144 +97,144 @@
 block discarded – undo
97 97
  */
98 98
 class LoggerNDC {
99 99
 
100
-    /**
101
-     * Clear any nested diagnostic information if any. This method is
102
-     * useful in cases where the same thread can be potentially used
103
-     * over and over in different unrelated contexts.
104
-     *
105
-     * <p>This method is equivalent to calling the {@link setMaxDepth()}
106
-     * method with a zero <var>maxDepth</var> argument.
107
-     *
108
-     * @static  
109
-     */
110
-    public function clear()
111
-    {
112
-        LoggerLog::debug("LoggerNDC::clear()");
100
+	/**
101
+	 * Clear any nested diagnostic information if any. This method is
102
+	 * useful in cases where the same thread can be potentially used
103
+	 * over and over in different unrelated contexts.
104
+	 *
105
+	 * <p>This method is equivalent to calling the {@link setMaxDepth()}
106
+	 * method with a zero <var>maxDepth</var> argument.
107
+	 *
108
+	 * @static  
109
+	 */
110
+	public function clear()
111
+	{
112
+		LoggerLog::debug("LoggerNDC::clear()");
113 113
         
114
-        $GLOBALS['log4php.LoggerNDC.ht'] = array();
115
-    }
114
+		$GLOBALS['log4php.LoggerNDC.ht'] = array();
115
+	}
116 116
 
117
-    /**
118
-     * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
119
-     * @static
120
-     * @return array
121
-     */
122
-    public function get()
123
-    {
124
-        LoggerLog::debug("LoggerNDC::get()");
117
+	/**
118
+	 * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
119
+	 * @static
120
+	 * @return array
121
+	 */
122
+	public function get()
123
+	{
124
+		LoggerLog::debug("LoggerNDC::get()");
125 125
     
126
-        return $GLOBALS['log4php.LoggerNDC.ht'];
127
-    }
126
+		return $GLOBALS['log4php.LoggerNDC.ht'];
127
+	}
128 128
   
129
-    /**
130
-     * Get the current nesting depth of this diagnostic context.
131
-     *
132
-     * @see setMaxDepth()
133
-     * @return integer
134
-     * @static
135
-     */
136
-    public function getDepth()
137
-    {
138
-        LoggerLog::debug("LoggerNDC::getDepth()");
129
+	/**
130
+	 * Get the current nesting depth of this diagnostic context.
131
+	 *
132
+	 * @see setMaxDepth()
133
+	 * @return integer
134
+	 * @static
135
+	 */
136
+	public function getDepth()
137
+	{
138
+		LoggerLog::debug("LoggerNDC::getDepth()");
139 139
     
140
-        return sizeof($GLOBALS['log4php.LoggerNDC.ht']);      
141
-    }
140
+		return sizeof($GLOBALS['log4php.LoggerNDC.ht']);      
141
+	}
142 142
 
143
-    /**
144
-     * Clients should call this method before leaving a diagnostic
145
-     * context.
146
-     *
147
-     * <p>The returned value is the value that was pushed last. If no
148
-     * context is available, then the empty string "" is returned.</p>
149
-     *
150
-     * @return string The innermost diagnostic context.
151
-     * @static
152
-     */
153
-    public function pop()
154
-    {
155
-        LoggerLog::debug("LoggerNDC::pop()");
143
+	/**
144
+	 * Clients should call this method before leaving a diagnostic
145
+	 * context.
146
+	 *
147
+	 * <p>The returned value is the value that was pushed last. If no
148
+	 * context is available, then the empty string "" is returned.</p>
149
+	 *
150
+	 * @return string The innermost diagnostic context.
151
+	 * @static
152
+	 */
153
+	public function pop()
154
+	{
155
+		LoggerLog::debug("LoggerNDC::pop()");
156 156
     
157
-        if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
158
-            return array_pop($GLOBALS['log4php.LoggerNDC.ht']);
159
-        } else {
160
-            return '';
161
-        }
162
-    }
157
+		if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
158
+			return array_pop($GLOBALS['log4php.LoggerNDC.ht']);
159
+		} else {
160
+			return '';
161
+		}
162
+	}
163 163
 
164
-    /**
165
-     * Looks at the last diagnostic context at the top of this NDC
166
-     * without removing it.
167
-     *
168
-     * <p>The returned value is the value that was pushed last. If no
169
-     * context is available, then the empty string "" is returned.</p>
170
-     * @return string The innermost diagnostic context.
171
-     * @static
172
-     */
173
-    public function peek()
174
-    {
175
-        LoggerLog::debug("LoggerNDC::peek()");
164
+	/**
165
+	 * Looks at the last diagnostic context at the top of this NDC
166
+	 * without removing it.
167
+	 *
168
+	 * <p>The returned value is the value that was pushed last. If no
169
+	 * context is available, then the empty string "" is returned.</p>
170
+	 * @return string The innermost diagnostic context.
171
+	 * @static
172
+	 */
173
+	public function peek()
174
+	{
175
+		LoggerLog::debug("LoggerNDC::peek()");
176 176
     
177
-        if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
178
-            return end($GLOBALS['log4php.LoggerNDC.ht']);
179
-        } else {
180
-            return '';
181
-        }
182
-    }
177
+		if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
178
+			return end($GLOBALS['log4php.LoggerNDC.ht']);
179
+		} else {
180
+			return '';
181
+		}
182
+	}
183 183
   
184
-    /**
185
-     * Push new diagnostic context information for the current thread.
186
-     *
187
-     * <p>The contents of the <var>message</var> parameter is
188
-     * determined solely by the client.
189
-     *  
190
-     * @param string $message The new diagnostic context information.
191
-     * @static  
192
-     */
193
-    public function push($message)
194
-    {
195
-        LoggerLog::debug("LoggerNDC::push()");
184
+	/**
185
+	 * Push new diagnostic context information for the current thread.
186
+	 *
187
+	 * <p>The contents of the <var>message</var> parameter is
188
+	 * determined solely by the client.
189
+	 *  
190
+	 * @param string $message The new diagnostic context information.
191
+	 * @static  
192
+	 */
193
+	public function push($message)
194
+	{
195
+		LoggerLog::debug("LoggerNDC::push()");
196 196
     
197
-        array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message);
198
-    }
197
+		array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message);
198
+	}
199 199
 
200
-    /**
201
-     * Remove the diagnostic context for this thread.
202
-     * @static
203
-     */
204
-    public function remove()
205
-    {
206
-        LoggerLog::debug("LoggerNDC::remove()");
200
+	/**
201
+	 * Remove the diagnostic context for this thread.
202
+	 * @static
203
+	 */
204
+	public function remove()
205
+	{
206
+		LoggerLog::debug("LoggerNDC::remove()");
207 207
     
208
-        LoggerNDC::clear();
209
-    }
208
+		LoggerNDC::clear();
209
+	}
210 210
 
211
-    /**
212
-     * Set maximum depth of this diagnostic context. If the current
213
-     * depth is smaller or equal to <var>maxDepth</var>, then no
214
-     * action is taken.
215
-     *
216
-     * <p>This method is a convenient alternative to multiple 
217
-     * {@link pop()} calls. Moreover, it is often the case that at 
218
-     * the end of complex call sequences, the depth of the NDC is
219
-     * unpredictable. The {@link setMaxDepth()} method circumvents
220
-     * this problem.
221
-     *
222
-     * @param integer $maxDepth
223
-     * @see getDepth()
224
-     * @static
225
-     */
226
-    public function setMaxDepth($maxDepth)
227
-    {
228
-        LoggerLog::debug("LoggerNDC::setMaxDepth() maxDepth='$maxDepth'");
211
+	/**
212
+	 * Set maximum depth of this diagnostic context. If the current
213
+	 * depth is smaller or equal to <var>maxDepth</var>, then no
214
+	 * action is taken.
215
+	 *
216
+	 * <p>This method is a convenient alternative to multiple 
217
+	 * {@link pop()} calls. Moreover, it is often the case that at 
218
+	 * the end of complex call sequences, the depth of the NDC is
219
+	 * unpredictable. The {@link setMaxDepth()} method circumvents
220
+	 * this problem.
221
+	 *
222
+	 * @param integer $maxDepth
223
+	 * @see getDepth()
224
+	 * @static
225
+	 */
226
+	public function setMaxDepth($maxDepth)
227
+	{
228
+		LoggerLog::debug("LoggerNDC::setMaxDepth() maxDepth='$maxDepth'");
229 229
     
230
-        $maxDepth = (int)$maxDepth;
231
-        if ($maxDepth <= LOGGER_NDC_HT_SIZE) {
232
-            if (LoggerNDC::getDepth() > $maxDepth) {
233
-                $GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
234
-            }
235
-            $GLOBALS['log4php.LoggerNDC.maxDepth'] = $maxDepth;            
236
-        }
237
-    }
230
+		$maxDepth = (int)$maxDepth;
231
+		if ($maxDepth <= LOGGER_NDC_HT_SIZE) {
232
+			if (LoggerNDC::getDepth() > $maxDepth) {
233
+				$GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
234
+			}
235
+			$GLOBALS['log4php.LoggerNDC.maxDepth'] = $maxDepth;            
236
+		}
237
+	}
238 238
   
239 239
 }
240 240
 ?>
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/LoggerAppender.php 1 patch
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -31,188 +31,188 @@
 block discarded – undo
31 31
  */
32 32
 class LoggerAppender {
33 33
 
34
-    /**
35
-     * Factory
36
-     *
37
-     * @param string $name appender name
38
-     * @param string $class create an instance of this appender class
39
-     * @return LoggerAppender
40
-     */
41
-    public function factory($name, $class)
42
-    {
43
-        $class = basename($class);
44
-        if (!empty($class)) {
45
-            if (!class_exists($class)) 
46
-                @include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
47
-            if (class_exists($class))
48
-                return new $class($name);
49
-        }
50
-        return null;
51
-    }
34
+	/**
35
+	 * Factory
36
+	 *
37
+	 * @param string $name appender name
38
+	 * @param string $class create an instance of this appender class
39
+	 * @return LoggerAppender
40
+	 */
41
+	public function factory($name, $class)
42
+	{
43
+		$class = basename($class);
44
+		if (!empty($class)) {
45
+			if (!class_exists($class)) 
46
+				@include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
47
+			if (class_exists($class))
48
+				return new $class($name);
49
+		}
50
+		return null;
51
+	}
52 52
     
53
-    /**
54
-     * Singleton
55
-     *
56
-     * @param string $name appender name
57
-     * @param string $class create or get a reference instance of this class
58
-     * @return LoggerAppender 
59
-     */
60
-    public function &singleton($name, $class = '')
61
-    {
62
-        static $instances;
53
+	/**
54
+	 * Singleton
55
+	 *
56
+	 * @param string $name appender name
57
+	 * @param string $class create or get a reference instance of this class
58
+	 * @return LoggerAppender 
59
+	 */
60
+	public function &singleton($name, $class = '')
61
+	{
62
+		static $instances;
63 63
         
64
-        if (!empty($name)) {
65
-            if (!isset($instances[$name])) {
66
-                if (!empty($class)) {
67
-                    $appender = LoggerAppender::factory($name, $class);
68
-                    if ($appender !== null) { 
69
-                        $instances[$name] = $appender;
70
-                        return $instances[$name];
71
-                    }
72
-                }
73
-                return null;
74
-            }
75
-            return $instances[$name];                
76
-        }        
77
-        return null;        
78
-    }
64
+		if (!empty($name)) {
65
+			if (!isset($instances[$name])) {
66
+				if (!empty($class)) {
67
+					$appender = LoggerAppender::factory($name, $class);
68
+					if ($appender !== null) { 
69
+						$instances[$name] = $appender;
70
+						return $instances[$name];
71
+					}
72
+				}
73
+				return null;
74
+			}
75
+			return $instances[$name];                
76
+		}        
77
+		return null;        
78
+	}
79 79
     
80
-    /* --------------------------------------------------------------------------*/
81
-    /* --------------------------------------------------------------------------*/
82
-    /* --------------------------------------------------------------------------*/
80
+	/* --------------------------------------------------------------------------*/
81
+	/* --------------------------------------------------------------------------*/
82
+	/* --------------------------------------------------------------------------*/
83 83
     
84
-    /**
85
-     * Add a filter to the end of the filter list.
86
-     *
87
-     * @param LoggerFilter $newFilter add a new LoggerFilter
88
-     * @abstract
89
-     */
90
-    public function addFilter($newFilter)
91
-    {
92
-        // override 
93
-    }
84
+	/**
85
+	 * Add a filter to the end of the filter list.
86
+	 *
87
+	 * @param LoggerFilter $newFilter add a new LoggerFilter
88
+	 * @abstract
89
+	 */
90
+	public function addFilter($newFilter)
91
+	{
92
+		// override 
93
+	}
94 94
     
95
-    /**
96
-     * Clear the list of filters by removing all the filters in it.
97
-     * @abstract
98
-     */
99
-    public function clearFilters()
100
-    {
101
-        // override    
102
-    }
95
+	/**
96
+	 * Clear the list of filters by removing all the filters in it.
97
+	 * @abstract
98
+	 */
99
+	public function clearFilters()
100
+	{
101
+		// override    
102
+	}
103 103
 
104
-    /**
105
-     * Return the first filter in the filter chain for this Appender. 
106
-     * The return value may be <i>null</i> if no is filter is set.
107
-     * @return Filter
108
-     */
109
-    public function &getFilter()
110
-    {
111
-        // override    
112
-    } 
104
+	/**
105
+	 * Return the first filter in the filter chain for this Appender. 
106
+	 * The return value may be <i>null</i> if no is filter is set.
107
+	 * @return Filter
108
+	 */
109
+	public function &getFilter()
110
+	{
111
+		// override    
112
+	} 
113 113
     
114
-    /**
115
-     * Release any resources allocated.
116
-     * Subclasses of {@link LoggerAppender} should implement 
117
-     * this method to perform proper closing procedures.
118
-     * @abstract
119
-     */
120
-    public function close()
121
-    {
122
-        //override me
123
-    }
114
+	/**
115
+	 * Release any resources allocated.
116
+	 * Subclasses of {@link LoggerAppender} should implement 
117
+	 * this method to perform proper closing procedures.
118
+	 * @abstract
119
+	 */
120
+	public function close()
121
+	{
122
+		//override me
123
+	}
124 124
 
125
-    /**
126
-     * This method performs threshold checks and invokes filters before
127
-     * delegating actual logging to the subclasses specific <i>append()</i> method.
128
-     * @param LoggerLoggingEvent $event
129
-     * @abstract
130
-     */
131
-    public function doAppend($event)
132
-    {
133
-        //override me    
134
-    }
125
+	/**
126
+	 * This method performs threshold checks and invokes filters before
127
+	 * delegating actual logging to the subclasses specific <i>append()</i> method.
128
+	 * @param LoggerLoggingEvent $event
129
+	 * @abstract
130
+	 */
131
+	public function doAppend($event)
132
+	{
133
+		//override me    
134
+	}
135 135
 
136
-    /**
137
-     * Get the name of this appender.
138
-     * @return string
139
-     */
140
-    public function getName()
141
-    {
142
-        //override me    
143
-    }
136
+	/**
137
+	 * Get the name of this appender.
138
+	 * @return string
139
+	 */
140
+	public function getName()
141
+	{
142
+		//override me    
143
+	}
144 144
 
145
-    /**
146
-     * Do not use this method.
147
-     *
148
-     * @param object $errorHandler
149
-     */
150
-    public function setErrorHandler($errorHandler)
151
-    {
152
-        // override me
153
-    }
145
+	/**
146
+	 * Do not use this method.
147
+	 *
148
+	 * @param object $errorHandler
149
+	 */
150
+	public function setErrorHandler($errorHandler)
151
+	{
152
+		// override me
153
+	}
154 154
     
155
-    /**
156
-     * Do not use this method.
157
-     * @return object Returns the ErrorHandler for this appender.
158
-     */
159
-    public function &getErrorHandler()
160
-    {
161
-        return $this->errorHandler;
162
-    } 
155
+	/**
156
+	 * Do not use this method.
157
+	 * @return object Returns the ErrorHandler for this appender.
158
+	 */
159
+	public function &getErrorHandler()
160
+	{
161
+		return $this->errorHandler;
162
+	} 
163 163
 
164
-    /**
165
-     * Set the Layout for this appender.
166
-     *
167
-     * @param LoggerLayout $layout
168
-     */
169
-    public function setLayout($layout)
170
-    {
171
-        // override me
172
-    }
164
+	/**
165
+	 * Set the Layout for this appender.
166
+	 *
167
+	 * @param LoggerLayout $layout
168
+	 */
169
+	public function setLayout($layout)
170
+	{
171
+		// override me
172
+	}
173 173
     
174
-    /**
175
-     * Returns this appender layout.
176
-     * @return LoggerLayout
177
-     */
178
-    public function &getLayout()
179
-    {
180
-        // override me
181
-    }
174
+	/**
175
+	 * Returns this appender layout.
176
+	 * @return LoggerLayout
177
+	 */
178
+	public function &getLayout()
179
+	{
180
+		// override me
181
+	}
182 182
 
183
-    /**
184
-     * Set the name of this appender.
185
-     *
186
-     * The name is used by other components to identify this appender.
187
-     *
188
-     * @param string $name
189
-     */
190
-    public function setName($name) 
191
-    {
192
-        // override me    
193
-    }
183
+	/**
184
+	 * Set the name of this appender.
185
+	 *
186
+	 * The name is used by other components to identify this appender.
187
+	 *
188
+	 * @param string $name
189
+	 */
190
+	public function setName($name) 
191
+	{
192
+		// override me    
193
+	}
194 194
 
195
-    /**
196
-     * Configurators call this method to determine if the appender
197
-     * requires a layout. 
198
-     *
199
-     * <p>If this method returns <i>true</i>, meaning that layout is required, 
200
-     * then the configurator will configure a layout using the configuration 
201
-     * information at its disposal.  If this method returns <i>false</i>, 
202
-     * meaning that a layout is not required, then layout configuration will be
203
-     * skipped even if there is available layout configuration
204
-     * information at the disposal of the configurator.</p>
205
-     *
206
-     * <p>In the rather exceptional case, where the appender
207
-     * implementation admits a layout but can also work without it, then
208
-     * the appender should return <i>true</i>.</p>
209
-     *
210
-     * @return boolean
211
-     */
212
-    public function requiresLayout()
213
-    {
214
-        // override me
215
-    }
195
+	/**
196
+	 * Configurators call this method to determine if the appender
197
+	 * requires a layout. 
198
+	 *
199
+	 * <p>If this method returns <i>true</i>, meaning that layout is required, 
200
+	 * then the configurator will configure a layout using the configuration 
201
+	 * information at its disposal.  If this method returns <i>false</i>, 
202
+	 * meaning that a layout is not required, then layout configuration will be
203
+	 * skipped even if there is available layout configuration
204
+	 * information at the disposal of the configurator.</p>
205
+	 *
206
+	 * <p>In the rather exceptional case, where the appender
207
+	 * implementation admits a layout but can also work without it, then
208
+	 * the appender should return <i>true</i>.</p>
209
+	 *
210
+	 * @return boolean
211
+	 */
212
+	public function requiresLayout()
213
+	{
214
+		// override me
215
+	}
216 216
 
217 217
 }
218 218
 ?>
219 219
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/log4php.debug/LoggerHierarchy.php 1 patch
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -52,196 +52,196 @@  discard block
 block discarded – undo
52 52
  */
53 53
 class LoggerHierarchy {
54 54
 
55
-    /**
56
-     * @var object currently unused
57
-     */
58
-    var $defaultFactory;
55
+	/**
56
+	 * @var object currently unused
57
+	 */
58
+	var $defaultFactory;
59 59
     
60
-    /**
61
-     * @var boolean activate internal logging
62
-     * @see LoggerLog
63
-     */
64
-    var $debug = false;
60
+	/**
61
+	 * @var boolean activate internal logging
62
+	 * @see LoggerLog
63
+	 */
64
+	var $debug = false;
65 65
 
66
-    /**
67
-     * @var array hierarchy tree. saves here all loggers
68
-     */
69
-    var $ht = array();
66
+	/**
67
+	 * @var array hierarchy tree. saves here all loggers
68
+	 */
69
+	var $ht = array();
70 70
     
71
-    /**
72
-     * @var LoggerRoot
73
-     */
74
-    var $root = null;
71
+	/**
72
+	 * @var LoggerRoot
73
+	 */
74
+	var $root = null;
75 75
     
76
-    /**
77
-     * @var LoggerRendererMap
78
-     */
79
-    var $rendererMap;
76
+	/**
77
+	 * @var LoggerRendererMap
78
+	 */
79
+	var $rendererMap;
80 80
 
81
-    /**
82
-     * @var LoggerLevel main level threshold
83
-     */
84
-    var $threshold;
81
+	/**
82
+	 * @var LoggerLevel main level threshold
83
+	 */
84
+	var $threshold;
85 85
     
86
-    /**
87
-     * @var boolean currently unused
88
-     */
89
-    var $emittedNoAppenderWarning       = false;
86
+	/**
87
+	 * @var boolean currently unused
88
+	 */
89
+	var $emittedNoAppenderWarning       = false;
90 90
 
91
-    /**
92
-     * @var boolean currently unused
93
-     */
94
-    var $emittedNoResourceBundleWarning = false;
91
+	/**
92
+	 * @var boolean currently unused
93
+	 */
94
+	var $emittedNoResourceBundleWarning = false;
95 95
     
96 96
     
97 97
 /* --------------------------------------------------------------------------*/
98 98
 /* --------------------------------------------------------------------------*/
99 99
 /* --------------------------------------------------------------------------*/
100 100
 
101
-    public function &singleton()
102
-    {
103
-        static $instance;
101
+	public function &singleton()
102
+	{
103
+		static $instance;
104 104
         
105
-        if (!isset($instance))
106
-            $instance = new LoggerHierarchy(new LoggerRoot());
107
-        return $instance;
108
-    }
105
+		if (!isset($instance))
106
+			$instance = new LoggerHierarchy(new LoggerRoot());
107
+		return $instance;
108
+	}
109 109
     
110
-    /**
111
-     * Create a new logger hierarchy.
112
-     * @param object $root the root logger
113
-     */
114
-    public function LoggerHierarchy($root)
115
-    {
116
-        $this->root    =& $root;
117
-        // Enable all level levels by default.
118
-        $this->setThreshold(LoggerLevel::getLevelAll());
119
-        $this->root->setHierarchy($this);
120
-        $this->rendererMap = new LoggerRendererMap();
121
-        $this->defaultFactory = new LoggerDefaultCategoryFactory();        
122
-    }
110
+	/**
111
+	 * Create a new logger hierarchy.
112
+	 * @param object $root the root logger
113
+	 */
114
+	public function LoggerHierarchy($root)
115
+	{
116
+		$this->root    =& $root;
117
+		// Enable all level levels by default.
118
+		$this->setThreshold(LoggerLevel::getLevelAll());
119
+		$this->root->setHierarchy($this);
120
+		$this->rendererMap = new LoggerRendererMap();
121
+		$this->defaultFactory = new LoggerDefaultCategoryFactory();        
122
+	}
123 123
      
124
-    /**
125
-     * Add a HierarchyEventListener event to the repository. 
126
-     * Not Yet Impl.
127
-     */
128
-    public function addHierarchyEventListener($listener)
129
-    {
130
-        return;
131
-    }
124
+	/**
125
+	 * Add a HierarchyEventListener event to the repository. 
126
+	 * Not Yet Impl.
127
+	 */
128
+	public function addHierarchyEventListener($listener)
129
+	{
130
+		return;
131
+	}
132 132
      
133
-    /**
134
-     * Add an object renderer for a specific class.
135
-     * Not Yet Impl.
136
-     */
137
-    public function addRenderer($classToRender, $or)
138
-    {
139
-        $this->rendererMap->put($classToRender, $or);
140
-    } 
133
+	/**
134
+	 * Add an object renderer for a specific class.
135
+	 * Not Yet Impl.
136
+	 */
137
+	public function addRenderer($classToRender, $or)
138
+	{
139
+		$this->rendererMap->put($classToRender, $or);
140
+	} 
141 141
     
142
-    /**
143
-     * This call will clear all logger definitions from the internal hashtable.
144
-     */
145
-    public function clear()
146
-    {
147
-        $this->ht = array();
148
-    }
142
+	/**
143
+	 * This call will clear all logger definitions from the internal hashtable.
144
+	 */
145
+	public function clear()
146
+	{
147
+		$this->ht = array();
148
+	}
149 149
       
150
-    public function emitNoAppenderWarning($cat)
151
-    {
152
-        return;
153
-    }
150
+	public function emitNoAppenderWarning($cat)
151
+	{
152
+		return;
153
+	}
154 154
     
155
-    /**
156
-     * Check if the named logger exists in the hierarchy.
157
-     * @param string $name
158
-     * @return boolean
159
-     */
160
-    public function exists($name)
161
-    {
162
-        return in_array($name, array_keys($this->ht));
163
-    }
155
+	/**
156
+	 * Check if the named logger exists in the hierarchy.
157
+	 * @param string $name
158
+	 * @return boolean
159
+	 */
160
+	public function exists($name)
161
+	{
162
+		return in_array($name, array_keys($this->ht));
163
+	}
164 164
 
165
-    public function fireAddAppenderEvent($logger, $appender)
166
-    {
167
-        return;
168
-    }
165
+	public function fireAddAppenderEvent($logger, $appender)
166
+	{
167
+		return;
168
+	}
169 169
     
170
-    /**
171
-     * @deprecated Please use {@link getCurrentLoggers()} instead.
172
-     */
173
-    public function &getCurrentCategories()
174
-    {
175
-        return $this->getCurrentLoggers();
176
-    }
170
+	/**
171
+	 * @deprecated Please use {@link getCurrentLoggers()} instead.
172
+	 */
173
+	public function &getCurrentCategories()
174
+	{
175
+		return $this->getCurrentLoggers();
176
+	}
177 177
     
178
-    /**
179
-     * Returns all the currently defined categories in this hierarchy as an array.
180
-     * @return array
181
-     */  
182
-    public function &getCurrentLoggers()
183
-    {
184
-        $loggers = array();
185
-        $loggerNames = array_keys($this->ht);
186
-        $enumLoggers = sizeof($loggerNames);
187
-        for ($i = 0; $i < $enumLoggers; $i++) {
188
-            $loggerName = $loggerNames[$i];
189
-            $loggers[] =& $this->ht[$loggerName];
190
-        }
191
-        return $loggers; 
192
-    }
178
+	/**
179
+	 * Returns all the currently defined categories in this hierarchy as an array.
180
+	 * @return array
181
+	 */  
182
+	public function &getCurrentLoggers()
183
+	{
184
+		$loggers = array();
185
+		$loggerNames = array_keys($this->ht);
186
+		$enumLoggers = sizeof($loggerNames);
187
+		for ($i = 0; $i < $enumLoggers; $i++) {
188
+			$loggerName = $loggerNames[$i];
189
+			$loggers[] =& $this->ht[$loggerName];
190
+		}
191
+		return $loggers; 
192
+	}
193 193
     
194
-    /**
195
-     * Return a new logger instance named as the first parameter using the default factory.
196
-     * 
197
-     * @param string $name logger name
198
-     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null     
199
-     * @return Logger
200
-     */
201
-    public function &getLogger($name, $factory = null)
202
-    {
203
-        if ($factory === null) {
204
-            return $this->getLoggerByFactory($name, $this->defaultFactory);
205
-        } else {
206
-            return $this->getLoggerByFactory($name, $factory);
207
-        }
208
-    } 
194
+	/**
195
+	 * Return a new logger instance named as the first parameter using the default factory.
196
+	 * 
197
+	 * @param string $name logger name
198
+	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null     
199
+	 * @return Logger
200
+	 */
201
+	public function &getLogger($name, $factory = null)
202
+	{
203
+		if ($factory === null) {
204
+			return $this->getLoggerByFactory($name, $this->defaultFactory);
205
+		} else {
206
+			return $this->getLoggerByFactory($name, $factory);
207
+		}
208
+	} 
209 209
     
210
-    /**
211
-     * Return a new logger instance named as the first parameter using the default factory.
212
-     * 
213
-     * @param string $name logger name
214
-     * @return Logger
215
-     * @todo merge with {@link getLogger()}
216
-     */
217
-    public function &getLoggerByFactory($name, $factory)
218
-    {
219
-        if (!isset($this->ht[$name])) {
220
-            LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger...");
221
-            $this->ht[$name] = $factory->makeNewLoggerInstance($name);
222
-            $this->ht[$name]->setHierarchy($this);
223
-            $nodes = explode('.', $name);
224
-            $firstNode = array_shift($nodes);
225
-            if ( $firstNode != $name && isset($this->ht[$firstNode])) {
226
-                LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]");            
227
-                $this->ht[$name]->parent =& $this->ht[$firstNode];
228
-            } else {
229
-                LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]");            
230
-                $this->ht[$name]->parent =& $this->root;
231
-            } 
232
-            if (sizeof($nodes) > 0) {
233
-                // find parent node
234
-                foreach ($nodes as $node) {
235
-                    $parentNode = "$firstNode.$node";
236
-                    if (isset($this->ht[$parentNode]) && $parentNode != $name) {
237
-                        LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]");                    
238
-                        $this->ht[$name]->parent =& $this->ht[$parentNode];
239
-                    }
240
-                    $firstNode .= ".$node";
241
-                }
242
-            }
243
-            // update children
244
-            /*
210
+	/**
211
+	 * Return a new logger instance named as the first parameter using the default factory.
212
+	 * 
213
+	 * @param string $name logger name
214
+	 * @return Logger
215
+	 * @todo merge with {@link getLogger()}
216
+	 */
217
+	public function &getLoggerByFactory($name, $factory)
218
+	{
219
+		if (!isset($this->ht[$name])) {
220
+			LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger...");
221
+			$this->ht[$name] = $factory->makeNewLoggerInstance($name);
222
+			$this->ht[$name]->setHierarchy($this);
223
+			$nodes = explode('.', $name);
224
+			$firstNode = array_shift($nodes);
225
+			if ( $firstNode != $name && isset($this->ht[$firstNode])) {
226
+				LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]");            
227
+				$this->ht[$name]->parent =& $this->ht[$firstNode];
228
+			} else {
229
+				LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]");            
230
+				$this->ht[$name]->parent =& $this->root;
231
+			} 
232
+			if (sizeof($nodes) > 0) {
233
+				// find parent node
234
+				foreach ($nodes as $node) {
235
+					$parentNode = "$firstNode.$node";
236
+					if (isset($this->ht[$parentNode]) && $parentNode != $name) {
237
+						LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]");                    
238
+						$this->ht[$name]->parent =& $this->ht[$parentNode];
239
+					}
240
+					$firstNode .= ".$node";
241
+				}
242
+			}
243
+			// update children
244
+			/*
245 245
             $children = array();
246 246
             foreach (array_keys($this->ht) as $nodeName) {
247 247
                 if ($nodeName != $name && substr($nodeName, 0, strlen($name)) == $name) {
@@ -249,140 +249,140 @@  discard block
 block discarded – undo
249 249
                 }
250 250
             }
251 251
             */
252
-        }            
253
-        return $this->ht[$name];
254
-    }
252
+		}            
253
+		return $this->ht[$name];
254
+	}
255 255
     
256
-    /**
257
-     * @return LoggerRendererMap Get the renderer map for this hierarchy.
258
-     */
259
-    public function &getRendererMap()
260
-    {
261
-        return $this->rendererMap;
262
-    }
256
+	/**
257
+	 * @return LoggerRendererMap Get the renderer map for this hierarchy.
258
+	 */
259
+	public function &getRendererMap()
260
+	{
261
+		return $this->rendererMap;
262
+	}
263 263
     
264
-    /**
265
-     * @return LoggerRoot Get the root of this hierarchy.
266
-     */ 
267
-    public function &getRootLogger()
268
-    {
269
-        if (!isset($this->root) || $this->root == null)
270
-            $this->root = new LoggerRoot();
271
-        return $this->root;
272
-    }
264
+	/**
265
+	 * @return LoggerRoot Get the root of this hierarchy.
266
+	 */ 
267
+	public function &getRootLogger()
268
+	{
269
+		if (!isset($this->root) || $this->root == null)
270
+			$this->root = new LoggerRoot();
271
+		return $this->root;
272
+	}
273 273
      
274
-    /**
275
-     * @return LoggerLevel Returns the threshold Level.
276
-     */
277
-    public function getThreshold()
278
-    {
279
-        return $this->threshold;
280
-    } 
274
+	/**
275
+	 * @return LoggerLevel Returns the threshold Level.
276
+	 */
277
+	public function getThreshold()
278
+	{
279
+		return $this->threshold;
280
+	} 
281 281
 
282
-    /**
283
-     * This method will return true if this repository is disabled 
284
-     * for level object passed as parameter and false otherwise.
285
-     * @return boolean
286
-     */
287
-    public function isDisabled($level)
288
-    {
289
-        return ($this->threshold->level > $level->level);
290
-    }
282
+	/**
283
+	 * This method will return true if this repository is disabled 
284
+	 * for level object passed as parameter and false otherwise.
285
+	 * @return boolean
286
+	 */
287
+	public function isDisabled($level)
288
+	{
289
+		return ($this->threshold->level > $level->level);
290
+	}
291 291
     
292
-    /**
293
-     * @deprecated Deprecated with no replacement.
294
-     */
295
-    public function overrideAsNeeded($override)
296
-    {
297
-        return;
298
-    } 
292
+	/**
293
+	 * @deprecated Deprecated with no replacement.
294
+	 */
295
+	public function overrideAsNeeded($override)
296
+	{
297
+		return;
298
+	} 
299 299
     
300
-    /**
301
-     * Reset all values contained in this hierarchy instance to their
302
-     * default. 
303
-     *
304
-     * This removes all appenders from all categories, sets
305
-     * the level of all non-root categories to <i>null</i>,
306
-     * sets their additivity flag to <i>true</i> and sets the level
307
-     * of the root logger to {@link LOGGER_LEVEL_DEBUG}.  Moreover,
308
-     * message disabling is set its default "off" value.
309
-     * 
310
-     * <p>Existing categories are not removed. They are just reset.
311
-     *
312
-     * <p>This method should be used sparingly and with care as it will
313
-     * block all logging until it is completed.</p>
314
-     */
315
-    public function resetConfiguration()
316
-    {
317
-        $root =& $this->getRootLogger();
300
+	/**
301
+	 * Reset all values contained in this hierarchy instance to their
302
+	 * default. 
303
+	 *
304
+	 * This removes all appenders from all categories, sets
305
+	 * the level of all non-root categories to <i>null</i>,
306
+	 * sets their additivity flag to <i>true</i> and sets the level
307
+	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.  Moreover,
308
+	 * message disabling is set its default "off" value.
309
+	 * 
310
+	 * <p>Existing categories are not removed. They are just reset.
311
+	 *
312
+	 * <p>This method should be used sparingly and with care as it will
313
+	 * block all logging until it is completed.</p>
314
+	 */
315
+	public function resetConfiguration()
316
+	{
317
+		$root =& $this->getRootLogger();
318 318
         
319
-        $root->setLevel(LoggerLevel::getLevelDebug());
320
-        $this->setThreshold(LoggerLevel::getLevelAll());
321
-        $this->shutDown();
322
-        $loggers =& $this->getCurrentLoggers();
323
-        $enumLoggers = sizeof($loggers);
324
-        for ($i = 0; $i < $enumLoggers; $i++) {
325
-            $loggers[$i]->setLevel(null);
326
-        	$loggers[$i]->setAdditivity(true);
327
-        	$loggers[$i]->setResourceBundle(null);
328
-        }
329
-        $this->rendererMap->clear();
330
-    }
319
+		$root->setLevel(LoggerLevel::getLevelDebug());
320
+		$this->setThreshold(LoggerLevel::getLevelAll());
321
+		$this->shutDown();
322
+		$loggers =& $this->getCurrentLoggers();
323
+		$enumLoggers = sizeof($loggers);
324
+		for ($i = 0; $i < $enumLoggers; $i++) {
325
+			$loggers[$i]->setLevel(null);
326
+			$loggers[$i]->setAdditivity(true);
327
+			$loggers[$i]->setResourceBundle(null);
328
+		}
329
+		$this->rendererMap->clear();
330
+	}
331 331
       
332
-    /**
333
-     * @deprecated Deprecated with no replacement.
334
-     */
335
-    public function setDisableOverride($override)
336
-    {
337
-        return;
338
-    }
332
+	/**
333
+	 * @deprecated Deprecated with no replacement.
334
+	 */
335
+	public function setDisableOverride($override)
336
+	{
337
+		return;
338
+	}
339 339
     
340
-    /**
341
-     * Used by subclasses to add a renderer to the hierarchy passed as parameter.
342
-     * @param string $renderedClass a LoggerRenderer class name
343
-     * @param LoggerRenderer $renderer
344
-     *
345
-     */
346
-    public function setRenderer($renderedClass, $renderer)
347
-    {
348
-        $this->rendererMap->put($renderedClass, $renderer);
349
-    }
340
+	/**
341
+	 * Used by subclasses to add a renderer to the hierarchy passed as parameter.
342
+	 * @param string $renderedClass a LoggerRenderer class name
343
+	 * @param LoggerRenderer $renderer
344
+	 *
345
+	 */
346
+	public function setRenderer($renderedClass, $renderer)
347
+	{
348
+		$this->rendererMap->put($renderedClass, $renderer);
349
+	}
350 350
     
351
-    /**
352
-     * set a new threshold level
353
-     *
354
-     * @param LoggerLevel $l
355
-     */
356
-    public function setThreshold($l)
357
-    {
358
-        if ($l !== null)
359
-            $this->threshold = $l;
360
-    }
351
+	/**
352
+	 * set a new threshold level
353
+	 *
354
+	 * @param LoggerLevel $l
355
+	 */
356
+	public function setThreshold($l)
357
+	{
358
+		if ($l !== null)
359
+			$this->threshold = $l;
360
+	}
361 361
     
362
-    /**
363
-     * Shutting down a hierarchy will <i>safely</i> close and remove
364
-     * all appenders in all categories including the root logger.
365
-     * 
366
-     * <p>Some appenders such as {@link LoggerSocketAppender}
367
-     * need to be closed before the
368
-     * application exists. Otherwise, pending logging events might be
369
-     * lost.
370
-     * 
371
-     * <p>The shutdown method is careful to close nested
372
-     * appenders before closing regular appenders. This is allows
373
-     * configurations where a regular appender is attached to a logger
374
-     * and again to a nested appender.
375
-     */
376
-    public function shutdown()
377
-    {
378
-        $this->root->removeAllAppenders();
379
-        $cats =& $this->getCurrentLoggers();
380
-        $enumCats = sizeof($cats);        
381
-        if ($enumCats > 0) {
382
-            for ($i = 0; $i < $enumCats; $i++) {
383
-                $cats[$i]->removeAllAppenders();
384
-            }
385
-        }
386
-    }  
362
+	/**
363
+	 * Shutting down a hierarchy will <i>safely</i> close and remove
364
+	 * all appenders in all categories including the root logger.
365
+	 * 
366
+	 * <p>Some appenders such as {@link LoggerSocketAppender}
367
+	 * need to be closed before the
368
+	 * application exists. Otherwise, pending logging events might be
369
+	 * lost.
370
+	 * 
371
+	 * <p>The shutdown method is careful to close nested
372
+	 * appenders before closing regular appenders. This is allows
373
+	 * configurations where a regular appender is attached to a logger
374
+	 * and again to a nested appender.
375
+	 */
376
+	public function shutdown()
377
+	{
378
+		$this->root->removeAllAppenders();
379
+		$cats =& $this->getCurrentLoggers();
380
+		$enumCats = sizeof($cats);        
381
+		if ($enumCats > 0) {
382
+			for ($i = 0; $i < $enumCats; $i++) {
383
+				$cats[$i]->removeAllAppenders();
384
+			}
385
+		}
386
+	}  
387 387
 } 
388 388
 ?>
389 389
\ No newline at end of file
Please login to merge, or discard this patch.