You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by ca...@apache.org on 2007/07/17 03:09:00 UTC
svn commit: r556784 [1/3] - in /incubator/log4php/trunk: ./ src/assembly/
src/log4php/ src/main/ src/main/php/ src/main/php/appenders/
src/main/php/config/ src/main/php/helpers/ src/main/php/layouts/
src/main/php/or/ src/main/php/spi/ src/main/php/vari...
Author: carnold
Date: Mon Jul 16 18:08:56 2007
New Revision: 556784
URL: http://svn.apache.org/viewvc?view=rev&rev=556784
Log:
Restructure project for Maven
Added:
incubator/log4php/trunk/TODO
- copied unchanged from r556714, incubator/log4php/trunk/src/php5/TODO
incubator/log4php/trunk/src/main/
incubator/log4php/trunk/src/main/php/
- copied from r556714, incubator/log4php/trunk/src/log4php/
incubator/log4php/trunk/src/site/xdoc/
- copied from r556714, incubator/log4php/trunk/src/xdocs/
incubator/log4php/trunk/src/test/
incubator/log4php/trunk/src/test/php/
- copied from r556714, incubator/log4php/trunk/src/php5/tests/
Removed:
incubator/log4php/trunk/build.properties.dist
incubator/log4php/trunk/phpdoc.ini
incubator/log4php/trunk/src/log4php/
incubator/log4php/trunk/src/main/php/LoggerCategory.php
incubator/log4php/trunk/src/main/php/log4php.html
incubator/log4php/trunk/src/php4/
incubator/log4php/trunk/src/php5/TODO
incubator/log4php/trunk/src/php5/log4php/
incubator/log4php/trunk/src/php5/tests/
incubator/log4php/trunk/src/site/xdoc/download.xml
incubator/log4php/trunk/src/site/xdoc/index.xml
incubator/log4php/trunk/src/site/xdoc/projectStatus.xml
incubator/log4php/trunk/src/tests/
incubator/log4php/trunk/src/xdocs/
Modified:
incubator/log4php/trunk/build.xml
incubator/log4php/trunk/pom.xml
incubator/log4php/trunk/src/assembly/bin.xml
incubator/log4php/trunk/src/main/php/Logger.php
incubator/log4php/trunk/src/main/php/LoggerAppender.php
incubator/log4php/trunk/src/main/php/LoggerAppenderSkeleton.php
incubator/log4php/trunk/src/main/php/LoggerBasicConfigurator.php
incubator/log4php/trunk/src/main/php/LoggerDefaultCategoryFactory.php
incubator/log4php/trunk/src/main/php/LoggerHierarchy.php
incubator/log4php/trunk/src/main/php/LoggerLayout.php
incubator/log4php/trunk/src/main/php/LoggerLevel.php
incubator/log4php/trunk/src/main/php/LoggerLog.php
incubator/log4php/trunk/src/main/php/LoggerMDC.php
incubator/log4php/trunk/src/main/php/LoggerManager.php
incubator/log4php/trunk/src/main/php/LoggerNDC.php
incubator/log4php/trunk/src/main/php/LoggerPropertyConfigurator.php
incubator/log4php/trunk/src/main/php/LoggerRoot.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDb.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php
incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
incubator/log4php/trunk/src/main/php/config/LoggerPropertyGetter.php
incubator/log4php/trunk/src/main/php/config/LoggerPropertySetter.php
incubator/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php
incubator/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php
incubator/log4php/trunk/src/main/php/helpers/LoggerPatternConverter.php
incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php
incubator/log4php/trunk/src/main/php/helpers/LoggerTransform.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
incubator/log4php/trunk/src/main/php/layouts/LoggerPatternLayout.php
incubator/log4php/trunk/src/main/php/layouts/LoggerXmlLayout.php
incubator/log4php/trunk/src/main/php/or/LoggerDefaultRenderer.php
incubator/log4php/trunk/src/main/php/or/LoggerObjectRenderer.php
incubator/log4php/trunk/src/main/php/or/LoggerRendererMap.php
incubator/log4php/trunk/src/main/php/spi/LoggerConfigurator.php
incubator/log4php/trunk/src/main/php/spi/LoggerFactory.php
incubator/log4php/trunk/src/main/php/spi/LoggerFilter.php
incubator/log4php/trunk/src/main/php/spi/LoggerLocationInfo.php
incubator/log4php/trunk/src/main/php/spi/LoggerLoggingEvent.php
incubator/log4php/trunk/src/main/php/varia/LoggerDenyAllFilter.php
incubator/log4php/trunk/src/main/php/varia/LoggerLevelMatchFilter.php
incubator/log4php/trunk/src/main/php/varia/LoggerLevelRangeFilter.php
incubator/log4php/trunk/src/main/php/varia/LoggerStringMatchFilter.php
incubator/log4php/trunk/src/main/php/xml/LoggerDOMConfigurator.php
incubator/log4php/trunk/src/php5/examples/cache.php
incubator/log4php/trunk/src/php5/examples/client.php
incubator/log4php/trunk/src/php5/examples/console.php
incubator/log4php/trunk/src/php5/examples/dailyfile.php
incubator/log4php/trunk/src/php5/examples/echo.php
incubator/log4php/trunk/src/php5/examples/file.php
incubator/log4php/trunk/src/php5/examples/levelmatchfilter.php
incubator/log4php/trunk/src/php5/examples/levelrangefilter.php
incubator/log4php/trunk/src/php5/examples/mail.php
incubator/log4php/trunk/src/php5/examples/mdc.php
incubator/log4php/trunk/src/php5/examples/ndc.php
incubator/log4php/trunk/src/php5/examples/php.php
incubator/log4php/trunk/src/php5/examples/server.php
incubator/log4php/trunk/src/php5/examples/simple.php
incubator/log4php/trunk/src/php5/examples/stringmatchfilter.php
incubator/log4php/trunk/src/php5/examples/syslog.php
incubator/log4php/trunk/src/site/apt/download.apt
incubator/log4php/trunk/src/site/apt/index.apt
incubator/log4php/trunk/src/site/apt/roadmap.apt
incubator/log4php/trunk/src/site/site.xml
incubator/log4php/trunk/src/test/php/AllTests.php
incubator/log4php/trunk/src/test/php/LoggerBasicConfiguratorTest.php
incubator/log4php/trunk/src/test/php/LoggerHierarchyTest.php
incubator/log4php/trunk/src/test/php/LoggerLevelTest.php
incubator/log4php/trunk/src/test/php/LoggerLogTest.php
incubator/log4php/trunk/src/test/php/LoggerManagerTest.php
incubator/log4php/trunk/src/test/php/LoggerRootTest.php
incubator/log4php/trunk/src/test/php/appenders/AllTests.php
incubator/log4php/trunk/src/test/php/appenders/LoggerAppenderConsoleTest.php
incubator/log4php/trunk/src/test/php/appenders/LoggerAppenderNullTest.php
incubator/log4php/trunk/src/test/php/or/AllTests.php
incubator/log4php/trunk/src/test/php/or/LoggerDefaultRendererTest.php
incubator/log4php/trunk/src/test/php/or/LoggerObjectRendererTest.php
incubator/log4php/trunk/src/test/php/or/LoggerRendererMapTest.php
incubator/log4php/trunk/src/test/php/phpunit.php
incubator/log4php/trunk/src/test/php/spi/AllTests.php
incubator/log4php/trunk/src/test/php/spi/LoggerLoggingEventTest.php
Modified: incubator/log4php/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/build.xml?view=diff&rev=556784&r1=556783&r2=556784
==============================================================================
--- incubator/log4php/trunk/build.xml (original)
+++ incubator/log4php/trunk/build.xml Mon Jul 16 18:08:56 2007
@@ -1,311 +1,70 @@
<!--
- Log4php ANT build script.
-
- $Revision$
--->
-<project name="log4php" default="usage" basedir=".">
-
- <!-- Give user a chance to override without editing this file or typing -D -->
- <property environment="env"/>
- <property file="${user.home}/.ant.properties"/>
- <property file="build.properties"/>
- <!-- Read the system environment variables and stores them in properties, -->
- <!-- prefixed with "env". -->
-
- <property name="logging-site" value="../logging-site"/>
-
- <!-- set global properties for this build -->
- <property name="src.dir" value="src" />
- <property name="doc.dir" value="docs" />
-
- <property name="build.dir" value="build" />
- <property name="build.src.dir" value="${build.dir}/src" />
- <!-- <property name="build.test.dir" value="${build.src.dir}/tests" /> -->
- <property name="build.doc.dir" value="${build.dir}/docs" />
- <property name="build.api.dir" value="${build.dir}/docs/api" />
-
- <property name="dist.dir" value="dist"/>
- <property name="dist.images" value="dist/images"/>
- <property name="dist.tmp" value="dist/tmp"/>
-
- <!-- Construct classpath for building the html pages -->
- <path id="site.classpath">
- <fileset dir="${logging-site}/lib">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <patternset id="source.files">
- <!-- include everything we want in the src directory
- that we didn't want in the dist itself -->
- <include name="**/*.php"/>
- <!--
- <include name="**/*.xml"/>
- <include name="**/*.htm*"/>
- <include name="**/*.dtd"/>
- -->
- <exclude name="**/*CVS*"/>
- </patternset>
-
- <patternset id="html.files">
- <!-- include everything we want in the html directory
- that we didn't want in the dist itself -->
- <include name="**/*.htm*"/>
- <include name="**/*.gif"/>
- <include name="**/*.png"/>
- <include name="**/*.jpg"/>
- <include name="**/*.jpeg"/>
- <include name="**/*.txt"/>
- <include name="**/*.css"/>
- <include name="**/*.js"/>
- <exclude name="**/*CVS*"/>
- </patternset>
-
- <patternset id="xml.files">
- <!-- include everything we want in the html directory
- that we didn't want in the dist itself -->
- <include name="**/*.xml"/>
- <include name="**/*.dtd"/>
- <include name="**/*.xsd"/>
- <include name="**/*.xsl"/>
- <exclude name="**/*CVS*"/>
- </patternset>
-
- <patternset id="php.files">
- <include name="**/*.php"/>
- <include name="**/*.php3"/>
- <include name="**/*.phps"/>
- </patternset>
-
- <patternset id="doc.files">
- <include name="**/*.doc"/>
- <include name="**/*.txt"/>
- <include name="**/*.pdf"/>
- <patternset refid="html.files" />
- </patternset>
-
- <patternset id="base.doc.files">
- <include name="README"/>
- <include name="INSTALL"/>
- <include name="LICENSE"/>
- <include name="ChangeLog"/>
- </patternset>
-
- <patternset id="test.files">
- <!-- include everything we want in the src directory
- that we didn't want in the dist itself -->
- <include name="**/*.php"/>
- <include name="**/*.xml"/>
- <include name="**/*.htm*"/>
- <include name="**/*.properties"/>
- <exclude name="**/*CVS*"/>
- </patternset>
-
- <patternset id="contribs.files">
- <!-- include everything we want in the src directory
- that we didn't want in the dist itself -->
- <include name="**/*"/>
- <exclude name="**/*CVS*"/>
- </patternset>
-
-
- <!-- Tasks -->
-
- <target name="clean" description="Cleans up build and dist directories">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.dir}"/>
- </target>
-
- <target name="usage">
- <echo>
-
- These are the targets supported by this ANT build scpript:
-
- build - compile all project files.
-
- phpdoc - build project phpdoc files
- doc - build project doc and phpdoc files
-
- dist - will create a complete distribution in dist/
- Setting the env variable NO_PHPDOC will build the distribution
- without running the phpdoc target.
-
- site - will create the www site
- </echo>
- </target>
-
- <!-- ================================================================= -->
- <!-- Initialize variables -->
- <!-- NOTE: all directories are relative to log4php/ -->
- <!-- ================================================================= -->
- <target name="init">
- <echo>Basedir is ${basedir}</echo>
- <tstamp />
- </target>
-
- <target name="build" depends="init" >
- <mkdir dir="${build.src.dir}/${name}"/>
- <copy todir="${build.src.dir}/${name}">
- <fileset dir="${src.dir}/${name}">
- <patternset refid="source.files"/>
- </fileset>
- </copy>
- <mkdir dir="${build.src.dir}/tests"/>
- <copy todir="${build.src.dir}/tests">
- <fileset dir="${src.dir}/tests">
- <patternset refid="test.files"/>
- </fileset>
- </copy>
- <mkdir dir="${build.dir}/contribs"/>
- <copy todir="${build.dir}/contribs">
- <fileset dir="${basedir}/contribs">
- <patternset refid="contribs.files"/>
- </fileset>
- </copy>
- </target>
-
- <target name="phpdoc" depends="build" unless="env.NO_PHPDOC" description="Compile the phpDocumentor API documentation to dist dir">
- <mkdir dir="${build.api.dir}"/>
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
- <!-- Copy and replace phpdoc.ini -->
- <copy file="${basedir}/phpdoc.ini" todir="${build.api.dir}"/>
- <replace file="${build.api.dir}/phpdoc.ini" token="@Name@" value="${Name}" />
- <replace file="${build.api.dir}/phpdoc.ini" token="@package@" value="${name}" />
- <replace file="${build.api.dir}/phpdoc.ini" token="@basedir@" value="${basedir}" />
- <replace file="${build.api.dir}/phpdoc.ini" token="@src.dir@" value="${basedir}/${build.src.dir}" />
- <replace file="${build.api.dir}/phpdoc.ini" token="@target@" value="${basedir}/${build.api.dir}" />
-
- <!-- Add html package info in source -->
- <copy todir="${build.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="html.files"/>
- </fileset>
- </copy>
- <replace dir="${build.src.dir}" token="@release@" value="${release}" />
-
- <!-- Copy README,INSTALL,CHANGELOG -->
- <copy todir="${build.src.dir}">
- <fileset dir="${basedir}">
- <patternset refid="base.doc.files"/>
- </fileset>
- </copy>
-
- <!-- exec phpdoc -->
- <exec executable="${phpdoc.exe}">
- <arg line="--useconfig ./${build.api.dir}/phpdoc.ini" />
- </exec>
-
- <delete>
- <fileset dir="${build.src.dir}">
- <patternset refid="base.doc.files"/>
- </fileset>
- </delete>
-
- <!-- Delete html package infos in source -->
- <delete>
- <fileset dir="${build.src.dir}">
- <patternset refid="html.files"/>
- </fileset>
- </delete>
- </target>
-
- <target name="doc" depends="phpdoc, site">
- <mkdir dir="${build.doc.dir}"/>
- <copy todir="${build.doc.dir}">
- <fileset dir="${doc.dir}">
- <patternset refid="doc.files"/>
- <patternset refid="base.doc.files"/>
- </fileset>
- </copy>
- <replace dir="${build.doc.dir}" token="@release@" value="${release}" />
- <copy file="${src.dir}/log4php/xml/log4php.dtd" todir="${build.doc.dir}"/>
- </target>
-
-
- <!-- ================================================================= -->
- <!-- Build a complete distribution. Results go to ${dist.images} -->
- <!-- ================================================================= -->
- <target name="dist" depends="build, doc, site">
- <delete dir="${dist.dir}"/>
- <delete verbose="yes">
- <fileset dir="${build.dir}">
- <patternset>
- <include name="**/*.bak"/>
- </patternset>
- </fileset>
- <fileset dir="${build.doc.dir}/api">
- <patternset>
- <include name="errors.html"/>
- <include name="phpdoc.ini"/>
- </patternset>
- </fileset>
- </delete>
- <mkdir dir="${dist.images}" />
- <mkdir dir="${dist.tmp}/${name}-${release}" />
- <copy todir="${dist.tmp}/${name}-${release}">
- <fileset dir="${build.dir}" includes="src/**, contribs/**, docs/**" />
- </copy>
- <copy verbose="yes" todir="${dist.tmp}/${name}-${release}">
- <fileset dir="${build.dir}/docs">
- <patternset refid="base.doc.files"/>
- </fileset>
- </copy>
- <touch datetime="${release-datetime}">
- <fileset dir="${dist.tmp}/${name}-${release}"/>
- </touch>
- <tar tarfile="${dist.images}/${name}-${release}.tar.gz"
- basedir="${dist.tmp}"
- includes="${name}-${release}/**"
- longfile="gnu"
- compression="gzip"
- />
- <zip zipfile="${dist.images}/${name}-${release}.zip"
- basedir="${dist.tmp}"
- includes="${name}-${release}/**" />
- </target>
-
- <!-- ============================ -->
- <!-- ======= New targets ======== -->
- <!-- ============================ -->
-
- <target name="prepareSite">
- <available classname="org.apache.velocity.anakia.AnakiaTask"
- property="AnakiaTask.present">
- <classpath refid="site.classpath"/>
- </available>
- </target>
-
- <target name="checkSite" depends="prepareSite" unless="AnakiaTask.present">
- <echo>
- AnakiaTask is not present in ${logging-site}/lib! Please check to make sure that
- velocity.jar is in your classpath.
- </echo>
- </target>
-
- <target name="site" depends="checkSite" if="AnakiaTask.present">
- <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
- <classpath refid="site.classpath"/>
- </taskdef>
- <mkdir dir="${build.doc.dir}/css"/>
- <copy file="${logging-site}/docs/css/site.css" tofile="${build.doc.dir}/css/site.css"/>
-
- <anakia basedir="${src.dir}/xdocs" destdir="${build.doc.dir}/"
- extension=".html"
- style="site.vsl"
- projectFile="stylesheets/project.xml"
- excludes="**/stylesheets/**, empty.xml"
- includes="**/*.xml"
- lastModifiedCheck="true"
- templatePath="${logging-site}/src/xdocs/stylesheets">
- </anakia>
+-->
+<project name="log4php" default="compile">
- <mkdir dir="${build.doc.dir}/images"/>
- <copy todir="${build.doc.dir}/images">
- <fileset dir="${src.dir}/xdocs/images">
- <patternset refid="html.files"/>
- </fileset>
- </copy>
-
- </target>
-
+ <!-- Use Maven 2 to build or manually place ant-contrib (http://ant-contrib.sf.net) on path -->
+ <taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" />
+
+ <target name="compile-file">
+ <exec executable="php" failonerror="true">
+ <arg value="-l"/>
+ <arg value="${src.php}"/>
+ </exec>
+ </target>
+
+ <target name="compile">
+ <foreach target="compile-file" param="src.php">
+ <path>
+ <fileset dir="." includes="src/main/php/**/*.php"/>
+ </path>
+ </foreach>
+ </target>
+
+ <target name="test-compile">
+ <foreach target="compile-file" param="src.php">
+ <path>
+ <fileset dir="." includes="src/test/php/**/*.php"/>
+ </path>
+ </foreach>
+ </target>
+
+ <target name="test">
+ <!-- PHPUnit3 must be installed for this to work.
+ See http://www.phpunit.de -->
+ <exec executable="phpunit" failonerror="false" dir="src/test/php">
+ <arg value="AllTests"/>
+ <arg value="AllTests.php"/>
+ </exec>
+ </target>
+
+ <target name="apidocs">
+ <!-- PHPDoc must be installed for this to work. -->
+ <mkdir dir="target/site/apidocs"/>
+ <exec executable="phpdoc" failonerror="false">
+ <arg value="-d"/>
+ <arg value="src/main/php"/>
+ <arg value="-t"/>
+ <arg value="target/site/apidocs"/>
+ </exec>
+ </target>
+
+
+ <target name="fixcrlf">
+ <fixcrlf srcdir="src" includes="**/*.php"/>
+ </target>
</project>
Modified: incubator/log4php/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/pom.xml?view=diff&rev=556784&r1=556783&r2=556784
==============================================================================
--- incubator/log4php/trunk/pom.xml (original)
+++ incubator/log4php/trunk/pom.xml Mon Jul 16 18:08:56 2007
@@ -76,10 +76,47 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
+ <phase>compile</phase>
+ <id>compile</id>
+ <configuration>
+ <tasks>
+ <ant target="compile"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <phase>test-compile</phase>
+ <id>test-compile</id>
+ <configuration>
+ <tasks>
+ <ant target="test-compile"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <phase>test</phase>
+ <id>test</id>
+ <configuration>
+ <tasks>
+ <ant target="test"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
<phase>site</phase>
- <id>untag-site</id>
+ <id>site</id>
<configuration>
<tasks>
+ <ant target="apidocs"/>
<taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" />
<replaceregexp file="target/site/source-repository.html" match="/tags/[^ ]*" replace="/trunk" flags="g" />
</tasks>
@@ -95,6 +132,11 @@
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b2</version>
+ </dependency>
</dependencies>
</plugin>
<plugin>
@@ -113,16 +155,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<dependencies>
Modified: incubator/log4php/trunk/src/assembly/bin.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/assembly/bin.xml?view=diff&rev=556784&r1=556783&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/assembly/bin.xml (original)
+++ incubator/log4php/trunk/src/assembly/bin.xml Mon Jul 16 18:08:56 2007
@@ -21,7 +21,7 @@
<format>zip</format>
<format>tar.gz</format>
</formats>
- <baseDirectory>apache-log4j-component-${project.version}</baseDirectory>
+ <baseDirectory>apache-log4php-${project.version}</baseDirectory>
<includeSiteDirectory>true</includeSiteDirectory>
<fileSets>
<fileSet>
@@ -31,13 +31,6 @@
<include>build.xml</include>
<include>pom.xml</include>
<include>src/**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>apache-log4j-component-${project.version}.jar</include>
</includes>
</fileSet>
</fileSets>
Modified: incubator/log4php/trunk/src/main/php/Logger.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/Logger.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/Logger.php (original)
+++ incubator/log4php/trunk/src/main/php/Logger.php Mon Jul 16 18:08:56 2007
@@ -1,12 +1,25 @@
<?php
/**
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 1999,2004 The Apache Software Foundation.
*
- * This software is published under the terms of the Apache Software
- * License version 2.0, a copy of which has been included with this
- * distribution in the LICENSE file.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category log4php
* @package log4php
+ * @author Marco Vassura
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version SVN: $Id$
+ * @link http://logging.apache.org/log4php
*/
/**
@@ -14,25 +27,288 @@
*/
if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-require_once(LOG4PHP_DIR . '/LoggerCategory.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
+/**
+ */
+require_once(LOG4PHP_DIR . '/LoggerLevel.php');
+require_once(LOG4PHP_DIR . '/spi/LoggerLoggingEvent.php');
/**
- * Main class for logging operations
+ * This class has been deprecated and replaced by the Logger subclass.
*
* @author Marco Vassura
* @version $Revision$
* @package log4php
+ * @see Logger
*/
-class Logger extends LoggerCategory {
+class Logger {
+
+ /**
+ * Additivity is set to true by default, that is children inherit the
+ * appenders of their ancestors by default.
+ * @var boolean
+ */
+ protected $additive = true;
+
+ /**
+ * @var string fully qualified class name
+ */
+ protected $fqcn = 'LoggerCategory';
/**
- * Constructor
- * @param string $name logger name
+ * @var LoggerLevel The assigned level of this category.
+ */
+ var $level = null;
+
+ /**
+ * @var string name of this category.
+ */
+ protected $name = '';
+
+ /**
+ * @var Logger The parent of this category.
*/
- function Logger($name)
+ protected $parent = null;
+
+ /**
+ * @var LoggerHierarchy the object repository
+ */
+ var $repository = null;
+
+ /**
+ * @var array collection of appenders
+ * @see LoggerAppender
+ */
+ var $aai = array();
+
+/* --------------------------------------------------------------------------*/
+/* --------------------------------------------------------------------------*/
+/* --------------------------------------------------------------------------*/
+
+ /**
+ * Constructor.
+ *
+ * @param string $name Category name
+ */
+ public function __construct($name)
{
- $this->LoggerCategory($name);
+ $this->name = $name;
+ }
+
+ /**
+ * Add a new Appender to the list of appenders of this Category instance.
+ *
+ * @param LoggerAppender $newAppender
+ */
+ public function addAppender($newAppender)
+ {
+ $appenderName = $newAppender->getName();
+ $this->aai[$appenderName] = $newAppender;
+ }
+
+ /**
+ * If assertion parameter is false, then logs msg as an error statement.
+ *
+ * @param bool $assertion
+ * @param string $msg message to log
+ */
+ public function assertLog($assertion = true, $msg = '')
+ {
+ if ($assertion == false) {
+ $this->error($msg);
+ }
+ }
+
+ /**
+ * Call the appenders in the hierarchy starting at this.
+ *
+ * @param LoggerLoggingEvent $event
+ */
+ public function callAppenders($event)
+ {
+ if (sizeof($this->aai) > 0) {
+ foreach (array_keys($this->aai) as $appenderName) {
+ $this->aai[$appenderName]->doAppend($event);
+ }
+ }
+ if ($this->parent != null and $this->getAdditivity()) {
+ $this->parent->callAppenders($event);
+ }
+ }
+
+ /**
+ * Log a message object with the DEBUG level including the caller.
+ *
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function debug($message, $caller = null)
+ {
+ $debugLevel = LoggerLevel::getLevelDebug();
+ if ($this->repository->isDisabled($debugLevel)) {
+ return;
+ }
+ if ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $debugLevel, $message);
+ }
+ }
+
+ /**
+ * Log a message object with the ERROR level including the caller.
+ *
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function error($message, $caller = null)
+ {
+ $errorLevel = LoggerLevel::getLevelError();
+ if ($this->repository->isDisabled($errorLevel)) {
+ return;
+ }
+ if ($errorLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $errorLevel, $message);
+ }
+ }
+
+ /**
+ * Deprecated. Please use LoggerManager::exists() instead.
+ *
+ * @param string $name
+ * @see LoggerManager::exists()
+ * @deprecated
+ */
+ public function exists($name)
+ {
+ return LoggerManager::exists($name);
+ }
+
+ /**
+ * Log a message object with the FATAL level including the caller.
+ *
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function fatal($message, $caller = null)
+ {
+ $fatalLevel = LoggerLevel::getLevelFatal();
+ if ($this->repository->isDisabled($fatalLevel)) {
+ return;
+ }
+ if ($fatalLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $fatalLevel, $message);
+ }
+ }
+
+ /**
+ * This method creates a new logging event and logs the event without further checks.
+ *
+ * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
+ * {@link error()} and {@link fatal()} wrappers.
+ *
+ * @param string $fqcn Fully Qualified Class Name of the Logger
+ * @param mixed $caller caller object or caller string id
+ * @param LoggerLevel $level log level
+ * @param mixed $message message
+ * @see LoggerLoggingEvent
+ */
+ public function forcedLog($fqcn, $caller, $level, $message)
+ {
+ // $fqcn = is_object($caller) ? get_class($caller) : (string)$caller;
+ $this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
+ }
+
+ /**
+ * Get the additivity flag for this Category instance.
+ * @return boolean
+ */
+ public function getAdditivity()
+ {
+ return $this->additive;
+ }
+
+ /**
+ * Get the appenders contained in this category as an array.
+ * @return array collection of appenders
+ */
+ public function getAllAppenders()
+ {
+ return array_values($this->aai);
+ }
+
+ /**
+ * Look for the appender named as name.
+ * @return LoggerAppender
+ */
+ public function getAppender($name)
+ {
+ return $this->aai[$name];
+ }
+
+ /**
+ * Please use the {@link getEffectiveLevel()} method instead.
+ * @deprecated
+ */
+ public function getChainedPriority()
+ {
+ return $this->getEffectiveLevel();
+ }
+
+ /**
+ * Please use {@link LoggerManager::getCurrentLoggers()} instead.
+ * @deprecated
+ */
+ public function getCurrentCategories()
+ {
+ return LoggerManager::getCurrentLoggers();
+ }
+
+ /**
+ * Please use {@link LoggerManager::getLoggerRepository()} instead.
+ * @deprecated
+ */
+ public function getDefaultHierarchy()
+ {
+ return LoggerManager::getLoggerRepository();
+ }
+
+ /**
+ * @deprecated Use {@link getLoggerRepository()}
+ * @return LoggerHierarchy
+ */
+ public function getHierarchy()
+ {
+ return $this->getLoggerRepository();
+ }
+
+ /**
+ * Starting from this category, search the category hierarchy for a non-null level and return it.
+ * @see LoggerLevel
+ * @return LoggerLevel or null
+ */
+ public function getEffectiveLevel()
+ {
+ for($c = $this; $c != null; $c = $c->parent) {
+ if($c->getLevel() !== null)
+ return $c->getLevel();
+ }
+ return null;
+ }
+
+ /**
+ * Retrieve a category with named as the name parameter.
+ * @return Logger
+ */
+ public function getInstance($name)
+ {
+ return LoggerManager::getLogger($name);
+ }
+
+ /**
+ * Returns the assigned Level, if any, for this Category.
+ * @return LoggerLevel or null
+ */
+ public function getLevel()
+ {
+ return $this->level;
}
/**
@@ -42,19 +318,282 @@
* @return Logger
* @static
*/
- function &getLogger($name, $factory = null)
+ public function getLogger($name, $factory = null)
{
return LoggerManager::getLogger($name, $factory);
}
/**
+ * Return the the repository where this Category is attached.
+ * @return LoggerHierarchy
+ */
+ public function getLoggerRepository()
+ {
+ return $this->repository;
+ }
+
+ /**
+ * Return the category name.
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Returns the parent of this category.
+ * @return Logger
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Please use getLevel() instead.
+ * @deprecated
+ */
+ public function getPriority()
+ {
+ return $this->getLevel();
+ }
+
+ /**
+ * Return the inherited ResourceBundle for this category.
+ */
+ public function getResourceBundle()
+ {
+ return;
+ }
+
+ /**
+ * Returns the string resource corresponding to key in this category's inherited resource bundle.
+ */
+ public function getResourceBundleString($key)
+ {
+ return;
+ }
+
+ /**
+ * Return the root of the default category hierarchy.
+ * @return LoggerRoot
+ */
+ public function getRoot()
+ {
+ return LoggerManager::getRootLogger();
+ }
+
+ /**
* get the Root Logger (Delegate to {@link LoggerManager})
* @return LoggerRoot
* @static
*/
- function &getRootLogger()
+ public function getRootLogger()
{
return LoggerManager::getRootLogger();
}
+
+ /**
+ * Log a message object with the INFO Level.
+ *
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function info($message, $caller = null)
+ {
+ $infoLevel = LoggerLevel::getLevelInfo();
+ if ($this->repository->isDisabled($infoLevel)) {
+ return;
+ }
+ if ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $infoLevel, $message);
+ }
+ }
+
+ /**
+ * Is the appender passed as parameter attached to this category?
+ *
+ * @param LoggerAppender $appender
+ */
+ public function isAttached($appender)
+ {
+ return isset($this->aai[$appender->getName()]);
+ }
+
+ /**
+ * Check whether this category is enabled for the DEBUG Level.
+ * @return boolean
+ */
+ public function isDebugEnabled()
+ {
+ $debugLevel = LoggerLevel::getLevelDebug();
+ if ($this->repository->isDisabled($debugLevel)) {
+ return false;
+ }
+ return ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel()));
+ }
+
+ /**
+ * Check whether this category is enabled for a given Level passed as parameter.
+ *
+ * @param LoggerLevel level
+ * @return boolean
+ */
+ public function isEnabledFor($level)
+ {
+ if ($this->repository->isDisabled($level)) {
+ return false;
+ }
+ return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
+ }
+
+ /**
+ * Check whether this category is enabled for the info Level.
+ * @return boolean
+ * @see LoggerLevel
+ */
+ public function isInfoEnabled()
+ {
+ $infoLevel = LoggerLevel::getLevelInfo();
+ if ($this->repository->isDisabled($infoLevel)) {
+ return false;
+ }
+ return ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel()));
+ }
+
+ /**
+ * Log a localized and parameterized message.
+ */
+ public function l7dlog($priority, $key, $params, $t)
+ {
+ return;
+ }
+
+ /**
+ * This generic form is intended to be used by wrappers.
+ *
+ * @param LoggerLevel $priority a valid level
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function log($priority, $message, $caller = null)
+ {
+ if ($this->repository->isDisabled($priority)) {
+ return;
+ }
+ if ($priority->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $priority, $message);
+ }
+ }
+
+ /**
+ * Remove all previously added appenders from this Category instance.
+ */
+ public function removeAllAppenders()
+ {
+ $appenderNames = array_keys($this->aai);
+ $enumAppenders = sizeof($appenderNames);
+ for ($i = 0; $i < $enumAppenders; $i++) {
+ $this->removeAppender($appenderNames[$i]);
+ }
+ }
+
+ /**
+ * Remove the appender passed as parameter form the list of appenders.
+ *
+ * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
+ */
+ public function removeAppender($appender)
+ {
+ if (is_a($appender, 'loggerappender')) {
+ $appender->close();
+ unset($this->aai[$appender->getName()]);
+ } elseif (is_string($appender) and isset($this->aai[$appender])) {
+ $this->aai[$appender]->close();
+ unset($this->aai[$appender]);
+ }
+ }
+
+ /**
+ * Set the additivity flag for this Category instance.
+ *
+ * @param boolean $additive
+ */
+ public function setAdditivity($additive)
+ {
+ $this->additive = (bool)$additive;
+ }
+
+ /**
+ * @deprecated Please use {@link setLevel()} instead.
+ * @see setLevel()
+ */
+ public function setPriority($priority)
+ {
+ $this->setLevel($priority);
+ }
+
+ /**
+ * Only the Hierarchy class can set the hierarchy of a
+ * category.
+ *
+ * @param LoggerHierarchy $repository
+ */
+ public function setHierarchy($repository)
+ {
+ $this->repository = $repository;
+ }
+
+ /**
+ * Set the level of this Category.
+ *
+ * @param LoggerLevel $level a level string or a level constant
+ */
+ public function setLevel($level)
+ {
+ $this->level = $level;
+ }
+
+ public function setParent($logger) {
+ if ($logger instanceof Logger) {
+ $this->parent = $logger;
+ }
+ }
+
+ /**
+ * Set the resource bundle to be used with localized logging methods
+ */
+ public function setResourceBundle($bundle)
+ {
+ return;
+ }
+
+ /**
+ * @deprecated use {@link LoggerManager::shutdown()} instead.
+ * @see LoggerManager::shutdown()
+ */
+ public function shutdown()
+ {
+ LoggerManager::shutdown();
+ }
+
+ /**
+ * Log a message with the WARN level.
+ *
+ * @param mixed $message message
+ * @param mixed $caller caller object or caller string id
+ */
+ public function warn($message, $caller = null)
+ {
+ $warnLevel = LoggerLevel::getLevelWarn();
+ if ($this->repository->isDisabled($warnLevel)) {
+ return;
+ }
+ if ($warnLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
+ $this->forcedLog($this->fqcn, $caller, $warnLevel, $message);
+ }
+ }
+
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerAppender.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerAppender.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerAppender.php Mon Jul 16 18:08:56 2007
@@ -20,9 +20,8 @@
* @author Marco Vassura
* @version $Revision$
* @package log4php
- * @abstract
*/
-class LoggerAppender {
+abstract class LoggerAppender {
/**
* Factory
@@ -31,12 +30,13 @@
* @param string $class create an instance of this appender class
* @return LoggerAppender
*/
- function factory($name, $class)
+ public static function factory($name, $class)
{
$class = basename($class);
if (!empty($class)) {
+
if (!class_exists($class))
- @include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
+ include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
if (class_exists($class))
return new $class($name);
}
@@ -50,14 +50,14 @@
* @param string $class create or get a reference instance of this class
* @return LoggerAppender
*/
- function &singleton($name, $class = '')
+ public static function singleton($name, $class = '')
{
static $instances;
if (!empty($name)) {
if (!isset($instances[$name])) {
if (!empty($class)) {
- $appender = LoggerAppender::factory($name, $class);
+ $appender = self::factory($name, $class);
if ($appender !== null) {
$instances[$name] = $appender;
return $instances[$name];
@@ -80,29 +80,20 @@
* @param LoggerFilter $newFilter add a new LoggerFilter
* @abstract
*/
- function addFilter($newFilter)
- {
- // override
- }
+ abstract public function addFilter($newFilter);
/**
* Clear the list of filters by removing all the filters in it.
* @abstract
*/
- function clearFilters()
- {
- // override
- }
+ abstract function clearFilters();
/**
* Return the first filter in the filter chain for this Appender.
* The return value may be <i>null</i> if no is filter is set.
- * @return Filter
+ * @return LoggerFilter
*/
- function &getFilter()
- {
- // override
- }
+ abstract function getFilter();
/**
* Release any resources allocated.
@@ -110,10 +101,7 @@
* this method to perform proper closing procedures.
* @abstract
*/
- function close()
- {
- //override me
- }
+ abstract public function close();
/**
* This method performs threshold checks and invokes filters before
@@ -121,57 +109,39 @@
* @param LoggerLoggingEvent $event
* @abstract
*/
- function doAppend($event)
- {
- //override me
- }
+ abstract public function doAppend($event);
/**
* Get the name of this appender.
* @return string
*/
- function getName()
- {
- //override me
- }
+ abstract public function getName();
/**
* Do not use this method.
*
* @param object $errorHandler
*/
- function setErrorHandler($errorHandler)
- {
- // override me
- }
+ abstract public function setErrorHandler($errorHandler);
/**
* Do not use this method.
* @return object Returns the ErrorHandler for this appender.
*/
- function &getErrorHandler()
- {
- return $this->errorHandler;
- }
+ abstract public function getErrorHandler();
/**
* Set the Layout for this appender.
*
* @param LoggerLayout $layout
*/
- function setLayout($layout)
- {
- // override me
- }
+ abstract public function setLayout($layout);
/**
* Returns this appender layout.
* @return LoggerLayout
*/
- function &getLayout()
- {
- // override me
- }
+ abstract public function getLayout();
/**
* Set the name of this appender.
@@ -180,10 +150,7 @@
*
* @param string $name
*/
- function setName($name)
- {
- // override me
- }
+ abstract public function setName($name);
/**
* Configurators call this method to determine if the appender
@@ -202,10 +169,7 @@
*
* @return boolean
*/
- function requiresLayout()
- {
- // override me
- }
+ abstract public function requiresLayout();
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerAppenderSkeleton.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerAppenderSkeleton.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerAppenderSkeleton.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerAppenderSkeleton.php Mon Jul 16 18:08:56 2007
@@ -32,62 +32,57 @@
* @package log4php
* @abstract
*/
-class LoggerAppenderSkeleton extends LoggerAppender {
+abstract class LoggerAppenderSkeleton extends LoggerAppender {
/**
* @var boolean closed appender flag
*/
- var $closed = false;
+ protected $closed = false;
/**
* @var object unused
*/
- var $errorHandler;
+ protected $errorHandler;
/**
* The first filter in the filter chain
* @var LoggerFilter
*/
- var $headFilter = null;
+ protected $headFilter = null;
/**
* LoggerLayout for this appender. It can be null if appender has its own layout
* @var LoggerLayout
*/
- var $layout = null;
+ protected $layout = null;
/**
* @var string Appender name
*/
- var $name;
+ protected $name;
/**
* The last filter in the filter chain
* @var LoggerFilter
*/
- var $tailFilter = null;
+ protected $tailFilter = null;
/**
* @var LoggerLevel There is no level threshold filtering by default.
*/
- var $threshold = null;
+ protected $threshold = null;
/**
* @var boolean needs a layout formatting ?
*/
- var $requiresLayout = false;
-
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
+ protected $requiresLayout = false;
/**
* Constructor
*
* @param string $name appender name
*/
- function LoggerAppenderSkeleton($name)
- {
+ public function __construct($name) {
$this->name = $name;
$this->clearFilters();
}
@@ -96,14 +91,13 @@
* @param LoggerFilter $newFilter add a new LoggerFilter
* @see LoggerAppender::addFilter()
*/
- function addFilter($newFilter)
- {
+ public function addFilter($newFilter) {
if($this->headFilter === null) {
$this->headFilter = $newFilter;
- $this->tailFilter =& $this->headFilter;
+ $this->tailFilter = $this->headFilter;
} else {
$this->tailFilter->next = $newFilter;
- $this->tailFilter =& $this->tailFilter->next;
+ $this->tailFilter = $this->tailFilter->next;
}
}
@@ -111,10 +105,7 @@
* Derived appenders should override this method if option structure
* requires it.
*/
- function activateOptions()
- {
-
- }
+ abstract public function activateOptions();
/**
* Subclasses of {@link LoggerAppenderSkeleton} should implement
@@ -124,15 +115,12 @@
* @see doAppend()
* @abstract
*/
- function append($event)
- {
- // override me
- }
+ abstract protected function append($event);
/**
* @see LoggerAppender::clearFilters()
*/
- function clearFilters()
+ public function clearFilters()
{
unset($this->headFilter);
unset($this->tailFilter);
@@ -141,17 +129,9 @@
}
/**
- * @see LoggerAppender::close()
- */
- function close()
- {
- //override me
- }
-
- /**
* Finalize this appender by calling the derived class' <i>close()</i> method.
*/
- function finalize()
+ public function finalize()
{
// An appender might be closed then garbage collected. There is no
// point in closing twice.
@@ -167,16 +147,16 @@
* @see LoggerAppender::getErrorHandler()
* @return object
*/
- function &getErrorHandler()
+ public function getErrorHandler()
{
return $this->errorHandler;
}
/**
* @see LoggerAppender::getFilter()
- * @return Filter
+ * @return LoggerFilter
*/
- function &getFilter()
+ public function getFilter()
{
return $this->headFilter;
}
@@ -184,9 +164,9 @@
/**
* Return the first filter in the filter chain for this Appender.
* The return value may be <i>null</i> if no is filter is set.
- * @return Filter
+ * @return LoggerFilter
*/
- function &getFirstFilter()
+ public function getFirstFilter()
{
return $this->headFilter;
}
@@ -195,7 +175,7 @@
* @see LoggerAppender::getLayout()
* @return LoggerLayout
*/
- function &getLayout()
+ public function getLayout()
{
return $this->layout;
}
@@ -204,7 +184,7 @@
* @see LoggerAppender::getName()
* @return string
*/
- function getName()
+ public function getName()
{
return $this->name;
}
@@ -214,7 +194,7 @@
* See the {@link setThreshold()} method for the meaning of this option.
* @return LoggerLevel
*/
- function &getThreshold()
+ public function getThreshold()
{
return $this->threshold;
}
@@ -227,7 +207,7 @@
* @param LoggerLevel $priority
* @return boolean true if priority is greater or equal than threshold
*/
- function isAsSevereAsThreshold($priority)
+ public function isAsSevereAsThreshold($priority)
{
if ($this->threshold === null)
return true;
@@ -239,7 +219,7 @@
* @see LoggerAppender::doAppend()
* @param LoggerLoggingEvent $event
*/
- function doAppend($event)
+ public function doAppend($event)
{
LoggerLog::debug("LoggerAppenderSkeleton::doAppend()");
@@ -258,7 +238,7 @@
switch ($f->decide($event)) {
case LOG4PHP_LOGGER_FILTER_DENY: return;
case LOG4PHP_LOGGER_FILTER_ACCEPT: return $this->append($event);
- case LOG4PHP_LOGGER_FILTER_NEUTRAL: $f = $f->next;
+ case LOG4PHP_LOGGER_FILTER_NEUTRAL: $f = $f->getNext();
}
}
$this->append($event);
@@ -269,7 +249,7 @@
* @see LoggerAppender::requiresLayout()
* @return boolean
*/
- function requiresLayout()
+ public function requiresLayout()
{
return $this->requiresLayout;
}
@@ -278,7 +258,7 @@
* @see LoggerAppender::setErrorHandler()
* @param object
*/
- function setErrorHandler($errorHandler)
+ public function setErrorHandler($errorHandler)
{
if($errorHandler == null) {
// We do not throw exception here since the cause is probably a
@@ -293,7 +273,7 @@
* @see LoggerAppender::setLayout()
* @param LoggerLayout $layout
*/
- function setLayout($layout)
+ public function setLayout($layout)
{
if ($this->requiresLayout())
$this->layout = $layout;
@@ -303,7 +283,7 @@
* @see LoggerAppender::setName()
* @param string $name
*/
- function setName($name)
+ public function setName($name)
{
$this->name = $name;
}
@@ -314,11 +294,11 @@
* @param mixed $threshold can be a {@link LoggerLevel} object or a string.
* @see LoggerOptionConverter::toLevel()
*/
- function setThreshold($threshold)
+ public function setThreshold($threshold)
{
if (is_string($threshold)) {
$this->threshold = LoggerOptionConverter::toLevel($threshold, null);
- }elseif (is_a($threshold, 'loggerlevel')) {
+ }elseif ($threshold instanceof LoggerLevel) {
$this->threshold = $threshold;
}
}
@@ -335,7 +315,7 @@
}
/**
- * Perform actions after object deserialization.
+ * Perform actions after object de-serialization.
*
* Call {@link activateOptions()} to properly setup the appender.
*/
@@ -345,4 +325,4 @@
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerBasicConfigurator.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerBasicConfigurator.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerBasicConfigurator.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerBasicConfigurator.php Mon Jul 16 18:08:56 2007
@@ -15,8 +15,8 @@
if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
require_once(LOG4PHP_DIR . '/spi/LoggerConfigurator.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerAppender.php');
+require_once(LOG4PHP_DIR . '/layouts/LoggerLayoutTTCC.php');
+require_once(LOG4PHP_DIR . '/appenders/LoggerAppenderConsole.php');
require_once(LOG4PHP_DIR . '/LoggerManager.php');
/**
@@ -28,35 +28,25 @@
* @author Marco Vassura
* @version $Revision$
* @package log4php
- * @since 0.5
*/
-class LoggerBasicConfigurator extends LoggerConfigurator {
-
- function LoggerBasicConfigurator()
- {
- return;
- }
+class LoggerBasicConfigurator implements LoggerConfigurator {
/**
* Add a {@link LoggerAppenderConsole} that uses
* the {@link LoggerLayoutTTCC} to the root category.
*
* @param string $url not used here
- * @static
*/
- function configure($url = null)
+ public static function configure($url = null)
{
- $root =& LoggerManager::getRootLogger();
-
- $appender =& LoggerAppender::singleton('A1', 'LoggerAppenderConsole');
- $layout = LoggerLayout::factory('LoggerLayoutTTCC');
- $appender->setLayout($layout);
-
+ $root = LoggerManager::getRootLogger();
+ $appender = new LoggerAppenderConsole('A1');
+ $appender->setLayout( new LoggerLayoutTTCC() );
$root->addAppender($appender);
}
/**
- * Reset the default hierarchy to its defaut.
+ * Reset the default hierarchy to its default.
* It is equivalent to
* <code>
* LoggerManager::resetConfiguration();
@@ -65,9 +55,9 @@
* @see LoggerHierarchy::resetConfiguration()
* @static
*/
- function resetConfiguration()
+ public static function resetConfiguration()
{
LoggerManager::resetConfiguration();
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerDefaultCategoryFactory.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerDefaultCategoryFactory.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerDefaultCategoryFactory.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerDefaultCategoryFactory.php Mon Jul 16 18:08:56 2007
@@ -27,19 +27,14 @@
*/
class LoggerDefaultCategoryFactory extends LoggerFactory {
- function LoggerDefaultCategoryFactory()
- {
- return;
- }
-
/**
* @param string $name
* @return Logger
*/
- function makeNewLoggerInstance($name)
+ public function makeNewLoggerInstance($name)
{
return new Logger($name);
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerHierarchy.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerHierarchy.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerHierarchy.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerHierarchy.php Mon Jul 16 18:08:56 2007
@@ -48,50 +48,45 @@
/**
* @var object currently unused
*/
- var $defaultFactory;
+ protected $defaultFactory;
/**
* @var boolean activate internal logging
* @see LoggerLog
*/
- var $debug = false;
+ public $debug = false;
/**
* @var array hierarchy tree. saves here all loggers
*/
- var $ht = array();
+ protected $ht = array();
/**
* @var LoggerRoot
*/
- var $root = null;
+ protected $root = null;
/**
* @var LoggerRendererMap
*/
- var $rendererMap;
+ protected $rendererMap;
/**
* @var LoggerLevel main level threshold
*/
- var $threshold;
+ protected $threshold;
/**
* @var boolean currently unused
*/
- var $emittedNoAppenderWarning = false;
+ protected $emittedNoAppenderWarning = false;
/**
* @var boolean currently unused
*/
- var $emittedNoResourceBundleWarning = false;
+ protected $emittedNoResourceBundleWarning = false;
-
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-
- function &singleton()
+ public static function singleton()
{
static $instance;
@@ -104,9 +99,9 @@
* Create a new logger hierarchy.
* @param object $root the root logger
*/
- function LoggerHierarchy($root)
+ protected function __construct($root)
{
- $this->root =& $root;
+ $this->root = $root;
// Enable all level levels by default.
$this->setThreshold(LoggerLevel::getLevelAll());
$this->root->setHierarchy($this);
@@ -118,16 +113,17 @@
* Add a HierarchyEventListener event to the repository.
* Not Yet Impl.
*/
- function addHierarchyEventListener($listener)
+ public function addHierarchyEventListener($listener)
{
return;
}
/**
* Add an object renderer for a specific class.
- * Not Yet Impl.
+ * @param string $classToRender
+ * @param LoggerObjectRenderer $or
*/
- function addRenderer($classToRender, $or)
+ public function addRenderer($classToRender, $or)
{
$this->rendererMap->put($classToRender, $or);
}
@@ -135,12 +131,12 @@
/**
* This call will clear all logger definitions from the internal hashtable.
*/
- function clear()
+ public function clear()
{
$this->ht = array();
}
- function emitNoAppenderWarning($cat)
+ public function emitNoAppenderWarning($cat)
{
return;
}
@@ -150,12 +146,17 @@
* @param string $name
* @return boolean
*/
- function exists($name)
+ public function exists($name)
{
- return in_array($name, array_keys($this->ht));
+ return isset($this->ht[$name]);
}
- function fireAddAppenderEvent($logger, $appender)
+ /**
+ * Not Implemented.
+ * @param Logger $logger
+ * @param LoggerAppender $appender
+ */
+ public function fireAddAppenderEvent($logger, $appender)
{
return;
}
@@ -163,7 +164,7 @@
/**
* @deprecated Please use {@link getCurrentLoggers()} instead.
*/
- function &getCurrentCategories()
+ public function getCurrentCategories()
{
return $this->getCurrentLoggers();
}
@@ -172,16 +173,9 @@
* Returns all the currently defined categories in this hierarchy as an array.
* @return array
*/
- function &getCurrentLoggers()
+ public function getCurrentLoggers()
{
- $loggers = array();
- $loggerNames = array_keys($this->ht);
- $enumLoggers = sizeof($loggerNames);
- for ($i = 0; $i < $enumLoggers; $i++) {
- $loggerName = $loggerNames[$i];
- $loggers[] =& $this->ht[$loggerName];
- }
- return $loggers;
+ return array_values($this->ht);
}
/**
@@ -191,7 +185,7 @@
* @param LoggerFactory $factory a {@link LoggerFactory} instance or null
* @return Logger
*/
- function &getLogger($name, $factory = null)
+ public function getLogger($name, $factory = null)
{
if ($factory === null) {
return $this->getLoggerByFactory($name, $this->defaultFactory);
@@ -207,41 +201,28 @@
* @return Logger
* @todo merge with {@link getLogger()}
*/
- function &getLoggerByFactory($name, $factory)
+ public function getLoggerByFactory($name, $factory)
{
if (!isset($this->ht[$name])) {
- LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger...");
$this->ht[$name] = $factory->makeNewLoggerInstance($name);
$this->ht[$name]->setHierarchy($this);
$nodes = explode('.', $name);
$firstNode = array_shift($nodes);
if ( $firstNode != $name and isset($this->ht[$firstNode])) {
- LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]");
- $this->ht[$name]->parent =& $this->ht[$firstNode];
+ $this->ht[$name]->setParent($this->ht[$firstNode]);
} else {
- LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]");
- $this->ht[$name]->parent =& $this->root;
+ $this->ht[$name]->setParent($this->root);
}
if (sizeof($nodes) > 0) {
// find parent node
foreach ($nodes as $node) {
$parentNode = "$firstNode.$node";
if (isset($this->ht[$parentNode]) and $parentNode != $name) {
- LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]");
- $this->ht[$name]->parent =& $this->ht[$parentNode];
+ $this->ht[$name]->setParent($this->ht[$parentNode]);
}
$firstNode .= ".$node";
}
}
- // update children
- /*
- $children = array();
- foreach (array_keys($this->ht) as $nodeName) {
- if ($nodeName != $name and substr($nodeName, 0, strlen($name)) == $name) {
- $children[] = $nodeName;
- }
- }
- */
}
return $this->ht[$name];
}
@@ -249,7 +230,7 @@
/**
* @return LoggerRendererMap Get the renderer map for this hierarchy.
*/
- function &getRendererMap()
+ public function getRendererMap()
{
return $this->rendererMap;
}
@@ -257,7 +238,7 @@
/**
* @return LoggerRoot Get the root of this hierarchy.
*/
- function &getRootLogger()
+ public function getRootLogger()
{
if (!isset($this->root) or $this->root == null)
$this->root = new LoggerRoot();
@@ -267,7 +248,7 @@
/**
* @return LoggerLevel Returns the threshold Level.
*/
- function getThreshold()
+ public function getThreshold()
{
return $this->threshold;
}
@@ -277,7 +258,7 @@
* for level object passed as parameter and false otherwise.
* @return boolean
*/
- function isDisabled($level)
+ public function isDisabled($level)
{
return ($this->threshold->level > $level->level);
}
@@ -285,7 +266,7 @@
/**
* @deprecated Deprecated with no replacement.
*/
- function overrideAsNeeded($override)
+ public function overrideAsNeeded($override)
{
return;
}
@@ -305,14 +286,14 @@
* <p>This method should be used sparingly and with care as it will
* block all logging until it is completed.</p>
*/
- function resetConfiguration()
+ public function resetConfiguration()
{
- $root =& $this->getRootLogger();
+ $root = $this->getRootLogger();
$root->setLevel(LoggerLevel::getLevelDebug());
$this->setThreshold(LoggerLevel::getLevelAll());
$this->shutDown();
- $loggers =& $this->getCurrentLoggers();
+ $loggers = $this->getCurrentLoggers();
$enumLoggers = sizeof($loggers);
for ($i = 0; $i < $enumLoggers; $i++) {
$loggers[$i]->setLevel(null);
@@ -326,7 +307,7 @@
/**
* @deprecated Deprecated with no replacement.
*/
- function setDisableOverride($override)
+ public function setDisableOverride($override)
{
return;
}
@@ -337,7 +318,7 @@
* @param LoggerRenderer $renderer
*
*/
- function setRenderer($renderedClass, $renderer)
+ public function setRenderer($renderedClass, $renderer)
{
$this->rendererMap->put($renderedClass, $renderer);
}
@@ -347,7 +328,7 @@
*
* @param LoggerLevel $l
*/
- function setThreshold($l)
+ public function setThreshold($l)
{
if ($l !== null)
$this->threshold = $l;
@@ -367,10 +348,10 @@
* configurations where a regular appender is attached to a logger
* and again to a nested appender.
*/
- function shutdown()
+ public function shutdown()
{
$this->root->removeAllAppenders();
- $cats =& $this->getCurrentLoggers();
+ $cats = $this->getCurrentLoggers();
$enumCats = sizeof($cats);
if ($enumCats > 0) {
for ($i = 0; $i < $enumCats; $i++) {
@@ -379,4 +360,4 @@
}
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerLayout.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLayout.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLayout.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLayout.php Mon Jul 16 18:08:56 2007
@@ -22,7 +22,7 @@
* @package log4php
* @abstract
*/
-class LoggerLayout {
+abstract class LoggerLayout {
/**
* Creates LoggerLayout instances with the given class name.
@@ -30,12 +30,12 @@
* @param string $class
* @return LoggerLayout
*/
- function factory($class)
+ public static function factory($class)
{
if (!empty($class)) {
$class = basename($class);
if (!class_exists($class))
- @include_once(LOG4PHP_DIR . "/layouts/{$class}.php");
+ include_once(LOG4PHP_DIR . "/layouts/{$class}.php");
if (class_exists($class))
return new $class();
}
@@ -45,10 +45,7 @@
/**
* Override this method
*/
- function activateOptions()
- {
- // override;
- }
+ abstract function activateOptions();
/**
* Override this method to create your own layout format.
@@ -56,7 +53,7 @@
* @param LoggerLoggingEvent
* @return string
*/
- function format($event)
+ public function format($event)
{
return $event->getRenderedMessage();
}
@@ -65,7 +62,7 @@
* Returns the content type output by this layout.
* @return string
*/
- function getContentType()
+ public function getContentType()
{
return "text/plain";
}
@@ -74,7 +71,7 @@
* Returns the footer for the layout format.
* @return string
*/
- function getFooter()
+ public function getFooter()
{
return null;
}
@@ -83,9 +80,9 @@
* Returns the header for the layout format.
* @return string
*/
- function getHeader()
+ public function getHeader()
{
return null;
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerLevel.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLevel.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLevel.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLevel.php Mon Jul 16 18:08:56 2007
@@ -45,17 +45,17 @@
/**
* @var integer
*/
- var $level;
+ public $level;
/**
* @var string
*/
- var $levelStr;
+ public $levelStr;
/**
* @var integer
*/
- var $syslogEquivalent;
+ public $syslogEquivalent;
/**
* Constructor
@@ -64,7 +64,7 @@
* @param string $levelStr
* @param integer $syslogEquivalent
*/
- function LoggerLevel($level, $levelStr, $syslogEquivalent)
+ public function __construct($level, $levelStr, $syslogEquivalent)
{
$this->level = $level;
$this->levelStr = $levelStr;
@@ -77,9 +77,9 @@
* @param object $o
* @return boolean
*/
- function equals($o)
+ public function equals($o)
{
- if (is_a($o, 'loggerlevel')) {
+ if ($o instanceof LoggerLevel) {
return ($this->level == $o->level);
} else {
return false;
@@ -91,7 +91,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelOff()
+ public static function getLevelOff()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0);
@@ -103,7 +103,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelFatal()
+ public static function getLevelFatal()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0);
@@ -115,7 +115,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelError()
+ public static function getLevelError()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3);
@@ -127,7 +127,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelWarn()
+ public static function getLevelWarn()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4);
@@ -139,7 +139,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelInfo()
+ public static function getLevelInfo()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6);
@@ -151,7 +151,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelDebug()
+ public static function getLevelDebug()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7);
@@ -163,7 +163,7 @@
* @static
* @return LoggerLevel
*/
- function &getLevelAll()
+ public static function getLevelAll()
{
static $level;
if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7);
@@ -175,7 +175,7 @@
* @final
* @return integer
*/
- function getSyslogEquivalent()
+ public function getSyslogEquivalent()
{
return $this->syslogEquivalent;
}
@@ -191,7 +191,7 @@
* @param LoggerLevel $r
* @return boolean
*/
- function isGreaterOrEqual($r)
+ public function isGreaterOrEqual($r)
{
return $this->level >= $r->level;
}
@@ -201,7 +201,7 @@
* @return string
* @final
*/
- function toString()
+ public function toString()
{
return $this->levelStr;
}
@@ -210,7 +210,7 @@
* Returns the integer representation of this level.
* @return integer
*/
- function toInt()
+ public function toInt()
{
return $this->level;
}
@@ -223,35 +223,35 @@
* @param LoggerLevel $default
* @static
*/
- function &toLevel($arg, $defaultLevel = null)
+ public static function toLevel($arg, $defaultLevel = null)
{
if ($defaultLevel === null) {
- return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug());
+ return self::toLevel($arg, self::getLevelDebug());
} else {
if (is_int($arg)) {
switch($arg) {
- case LOG4PHP_LEVEL_ALL_INT: return LoggerLevel::getLevelAll();
- case LOG4PHP_LEVEL_DEBUG_INT: return LoggerLevel::getLevelDebug();
- case LOG4PHP_LEVEL_INFO_INT: return LoggerLevel::getLevelInfo();
- case LOG4PHP_LEVEL_WARN_INT: return LoggerLevel::getLevelWarn();
- case LOG4PHP_LEVEL_ERROR_INT: return LoggerLevel::getLevelError();
- case LOG4PHP_LEVEL_FATAL_INT: return LoggerLevel::getLevelFatal();
- case LOG4PHP_LEVEL_OFF_INT: return LoggerLevel::getLevelOff();
+ case LOG4PHP_LEVEL_ALL_INT: return self::getLevelAll();
+ case LOG4PHP_LEVEL_DEBUG_INT: return self::getLevelDebug();
+ case LOG4PHP_LEVEL_INFO_INT: return self::getLevelInfo();
+ case LOG4PHP_LEVEL_WARN_INT: return self::getLevelWarn();
+ case LOG4PHP_LEVEL_ERROR_INT: return self::getLevelError();
+ case LOG4PHP_LEVEL_FATAL_INT: return self::getLevelFatal();
+ case LOG4PHP_LEVEL_OFF_INT: return self::getLevelOff();
default: return $defaultLevel;
}
} else {
switch(strtoupper($arg)) {
- case 'ALL': return LoggerLevel::getLevelAll();
- case 'DEBUG': return LoggerLevel::getLevelDebug();
- case 'INFO': return LoggerLevel::getLevelInfo();
- case 'WARN': return LoggerLevel::getLevelWarn();
- case 'ERROR': return LoggerLevel::getLevelError();
- case 'FATAL': return LoggerLevel::getLevelFatal();
- case 'OFF': return LoggerLevel::getLevelOff();
+ case 'ALL': return self::getLevelAll();
+ case 'DEBUG': return self::getLevelDebug();
+ case 'INFO': return self::getLevelInfo();
+ case 'WARN': return self::getLevelWarn();
+ case 'ERROR': return self::getLevelError();
+ case 'FATAL': return self::getLevelFatal();
+ case 'OFF': return self::getLevelOff();
default: return $defaultLevel;
}
}
}
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerLog.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLog.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLog.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLog.php Mon Jul 16 18:08:56 2007
@@ -27,6 +27,8 @@
*/
class LoggerLog {
+ protected static $debug = false;
+
/**
* Log if debug is enabled.
*
@@ -37,19 +39,17 @@
* @param integer $errLevel level to log
* @static
*/
- function log($message, $errLevel = E_USER_NOTICE)
+ public static function log($message, $errLevel = E_USER_NOTICE)
{
if (LoggerLog::internalDebugging())
trigger_error($message, $errLevel);
}
- function internalDebugging($value = null)
+ public static function internalDebugging($value = null)
{
- static $debug = false;
-
if (is_bool($value))
- $debug = $value;
- return $debug;
+ self::$debug = $value;
+ return self::$debug;
}
/**
@@ -59,7 +59,7 @@
* @static
* @since 0.3
*/
- function debug($message)
+ public static function debug($message)
{
LoggerLog::log($message, E_USER_NOTICE);
}
@@ -71,7 +71,7 @@
* @static
* @since 0.3
*/
- function error($message)
+ public static function error($message)
{
trigger_error($message, E_USER_ERROR);
}
@@ -83,10 +83,10 @@
* @static
* @since 0.3
*/
- function warn($message)
+ public static function warn($message)
{
trigger_error($message, E_USER_WARNING);
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerMDC.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerMDC.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerMDC.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerMDC.php Mon Jul 16 18:08:56 2007
@@ -57,7 +57,7 @@
* @param string $value the value
* @static
*/
- function put($key, $value)
+ public static function put($key, $value)
{
if ( sizeof($GLOBALS['log4php.LoggerMDC.ht']) < LOGGER_MDC_HT_SIZE )
$GLOBALS['log4php.LoggerMDC.ht'][$key] = $value;
@@ -76,7 +76,7 @@
* @return string
* @static
*/
- function get($key)
+ public static function get($key)
{
LoggerLog::debug("LoggerMDC::get() key='$key'");
@@ -113,10 +113,10 @@
* @return string
* @static
*/
- function remove($key)
+ public static function remove($key)
{
unset($GLOBALS['log4php.LoggerMDC.ht'][$key]);
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerManager.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerManager.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerManager.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerManager.php Mon Jul 16 18:08:56 2007
@@ -39,10 +39,9 @@
* @static
* @return boolean
*/
- function exists($name)
+ public static function exists($name)
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->exists($name);
+ return self::getLoggerRepository()->exists($name);
}
/**
@@ -52,10 +51,9 @@
* @see Logger
* @return array
*/
- function getCurrentLoggers()
+ public static function getCurrentLoggers()
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->getCurrentLoggers();
+ return self::getLoggerRepository()->getCurrentLoggers();
}
/**
@@ -65,10 +63,9 @@
* @return object
* @see LoggerRoot
*/
- function &getRootLogger()
+ public static function getRootLogger()
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->getRootLogger();
+ return self::getLoggerRepository()->getRootLogger();
}
/**
@@ -79,10 +76,9 @@
* @static
* @return Logger
*/
- function &getLogger($name, $factory = null)
+ public static function getLogger($name, $factory = null)
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->getLogger($name, $factory);
+ return self::getLoggerRepository()->getLogger($name, $factory);
}
/**
@@ -91,7 +87,7 @@
* @static
* @return LoggerHierarchy
*/
- function &getLoggerRepository()
+ public static function getLoggerRepository()
{
return LoggerHierarchy::singleton();
}
@@ -103,17 +99,16 @@
* @static
* @return boolean
*/
- function resetConfiguration()
+ public static function resetConfiguration()
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->resetConfiguration();
+ return self::getLoggerRepository()->resetConfiguration();
}
/**
* Does nothing.
* @static
*/
- function setRepositorySelector($selector, $guard)
+ public static function setRepositorySelector($selector, $guard)
{
return;
}
@@ -122,10 +117,9 @@
* Safely close all appenders.
* @static
*/
- function shutdown()
+ public static function shutdown()
{
- $repository =& LoggerManager::getLoggerRepository();
- return $repository->shutdown();
+ return self::getLoggerRepository()->shutdown();
}
}
@@ -240,7 +234,7 @@
{
$configuratorClass = basename(LOG4PHP_CONFIGURATOR_CLASS);
if (!class_exists($configuratorClass)) {
- @include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");
+ include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");
}
if (class_exists($configuratorClass)) {
@@ -252,4 +246,4 @@
}
}
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/main/php/LoggerNDC.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerNDC.php?view=diff&rev=556784&r1=556714&r2=556784
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerNDC.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerNDC.php Mon Jul 16 18:08:56 2007
@@ -100,7 +100,7 @@
*
* @static
*/
- function clear()
+ public static function clear()
{
LoggerLog::debug("LoggerNDC::clear()");
@@ -112,7 +112,7 @@
* @static
* @return array
*/
- function get()
+ public static function get()
{
LoggerLog::debug("LoggerNDC::get()");
@@ -126,7 +126,7 @@
* @return integer
* @static
*/
- function getDepth()
+ public static function getDepth()
{
LoggerLog::debug("LoggerNDC::getDepth()");
@@ -143,7 +143,7 @@
* @return string The innermost diagnostic context.
* @static
*/
- function pop()
+ public static function pop()
{
LoggerLog::debug("LoggerNDC::pop()");
@@ -163,7 +163,7 @@
* @return string The innermost diagnostic context.
* @static
*/
- function peek()
+ public static function peek()
{
LoggerLog::debug("LoggerNDC::peek()");
@@ -183,7 +183,7 @@
* @param string $message The new diagnostic context information.
* @static
*/
- function push($message)
+ public static function push($message)
{
LoggerLog::debug("LoggerNDC::push()");
@@ -194,7 +194,7 @@
* Remove the diagnostic context for this thread.
* @static
*/
- function remove()
+ public static function remove()
{
LoggerLog::debug("LoggerNDC::remove()");
@@ -216,7 +216,7 @@
* @see getDepth()
* @static
*/
- function setMaxDepth($maxDepth)
+ public static function setMaxDepth($maxDepth)
{
LoggerLog::debug("LoggerNDC::setMaxDepth() maxDepth='$maxDepth'");
@@ -230,4 +230,4 @@
}
}
-?>
\ No newline at end of file
+?>