<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Christian Grobmeier - JEE, EAI, PHP &#187; Apache Log4PHP</title>
	<atom:link href="http://www.grobmeier.de/category/apache-log4php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.grobmeier.de</link>
	<description>A Blog about technical thoughts</description>
	<lastBuildDate>Wed, 02 Jun 2010 12:32:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Welcome Zeta Components!</title>
		<link>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html</link>
		<comments>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html#comments</comments>
		<pubDate>Wed, 02 Jun 2010 12:32:00 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PIWI]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Incubator]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zeta Components]]></category>

		<guid isPermaLink="false">http://www.grobmeier.de/?p=423</guid>
		<description><![CDATA[Zeta Components is a component based PHP library and it joined the Apache Incubator before short time. It's pretty good to have another PHP project on Board - additionally I expect good effects on the PIWI framework.]]></description>
			<content:encoded><![CDATA[<p>Before a while, there was a very promising Proposal called <a href="http://wiki.apache.org/incubator/ZetaComponentsProposal" target="_blank">Zeta Components</a> at the Apache Incubator list. It described a set of PHP components similar which eases the life of us all. It has already progressed very good before developers decided to switch to Apache. In the past days this library has been developed under the name <a href="http://ezcomponents.org/" target="_blank">eZ Components</a> and was wellknown to the community.</p>
<p>In my opinion this new project will be very important to the ASF. Apache only hosts two other PHP projects, Log4PHP and Shindig. Since PHP is becoming more and more popular for big business (think on Facebook) I think its necessary to attract more developers and bring them into the Apache community. Many PHP projects out there use the GPL license, and that is sometimes very difficult to combine with commerical work. Good that we now have a component framework under ASL! Together with Log4PHP it&#8217;s a good start for much proprietary work.</p>
<p>More in future, I think that even the <a href="http://code.google.com/p/piwi/" target="_blank">PIWI Framework</a> will benefit of this change. I already had some trouble with dependent GPL code in it and hopefully Zeta can address most of my wishes. PIWI built upon Log4PHP and Zeta would be charming. But as already said, this will need a while.</p>
<p>At the moment, Zeta Components do already have a mailinglists and <a href="http://incubator.apache.org/projects/zetacomponents.html" target="_blank">status page</a> on the incubator. Jira will follow and after finally the CLAs of the initial developers have been processed, work can begin. However, if you are interest in helping this project subscribe to the user and to the dev list mentioned in the status page.</p>
<p>Lucky me I have been elected into the Apache Incubator PMC and can now serve as a mentor to this project. It&#8217;s not only honour to me, it&#8217;s also a good chance to work with obviously very nice people and excellent technicians. Also it makes it easy to me to step into this project and learn all I need.</p>
<p>So, welcome Zeta Components!! I am glad you arrived at the Apache Software Foundation!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log4PHP graduated!</title>
		<link>http://www.grobmeier.de/2010/03/11/log4php-graduated.html</link>
		<comments>http://www.grobmeier.de/2010/03/11/log4php-graduated.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 18:13:58 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.grobmeier.de/?p=359</guid>
		<description><![CDATA[Log4PHP graduated as subproject to the Apache Logging project. ]]></description>
			<content:encoded><![CDATA[<p>Good news! The Apache Incubator Log4PHP project graduated as subproject to the Apache Logging project. This is really a big step forward! The next days I will try to push the real work behind a graduation forward, moving webpages and svn and such. After that move we&#8217;ll continue with a new small release. Cheers all!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/03/11/log4php-graduated.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Log4PHP tries to graduate to Apache Logging</title>
		<link>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html</link>
		<comments>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 08:09:07 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=302</guid>
		<description><![CDATA[Log4PHP is about graduating to Apache Logging Services.]]></description>
			<content:encoded><![CDATA[<p>The past year has been very well for Log4PHP. As you might have noticed, the <a href="http://incubator.apache.org/log4php/download.html" target="_blank">Log4PHP 2.0.0</a> release is out. There has been some good feedback so far. Some users even contributed smaller bugfixes or the trace level which wasn&#8217;t in the API before. Besides that, there is a good activity on the mailinglist and there are at least 3 active committers. In other terms: time to graduate an bring out Log4PHP from the temporary incubator project <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Now Log4PHP needs to succeed 3 votes. One for the Log4PHP team to vote for graduating; one for Apache Logging to accept the podling as a subproject. And finally &#8211; after the first two have succeeded &#8211; a vote on the incubator list to release the podling to its final destination.</p>
<p>The first two votes are already running and it looks very good so far. Votes need to be open another day then the next step can be done. For those who are interested &#8211; there is a <a href="http://incubator.apache.org/guides/graduation.html" target="_blank">detailed document about graduation available</a>.</p>
<p>Let&#8217;s see how it works out &#8211; I think everything could be in place in quite less time, maybe the next two or three weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log4PHP 2.0.0 released</title>
		<link>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html</link>
		<comments>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html#comments</comments>
		<pubDate>Mon, 14 Dec 2009 06:29:11 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=282</guid>
		<description><![CDATA[Apache Log4PHP 2.0.0 has been released]]></description>
			<content:encoded><![CDATA[<p>After long work, I sent out the announcement for the first Log4PHP release this morning. Let&#8217;s see how this one works out &#8211; first reports from DBpedia users were promising. <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>It&#8217;s an exciting time for all involved, and is the result of a culmination of many like-minded individuals. Everyone&#8217;s worked hard and as the initial test community seem to have responded positively and in such detail they could test anything from Word to Think Bingo (<a href="http://www.thinkbingo.com/" target="_blank">http://www.thinkbingo.com/</a>) with their eyes closed. The people behind the development had a few words on the announcement of the first Log4PHP.</p>
<p>Here is the original statement:</p>
<p>The Log4PHP community is pleased to introduce the Apache Log4PHP 2.0.0 (Incubating) release [1]. It&#8217;s the first Log4PHP release since 2004 and tons of changes have been done. Finally Log4PHP has become a well tested framework made for PHP 5. Many thanks to all the contributors who made this release possible. Please download [2] Log4PHP and enjoy <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The Log4PHP team</p>
<p>[1] <a href="http://incubator.apache.org/log4php/changes-report.html" target="_blank">http://incubator.apache.org/log4php/changes-report.html</a><br />
[2] <a href="http://incubator.apache.org/log4php/download.html">http://incubator.apache.org/log4php/download.html </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Performance of nonblocking writes to files via PHP</title>
		<link>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html</link>
		<comments>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:21:03 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=254</guid>
		<description><![CDATA[Comparision of performance between the different options to write to a logfile (nonblocking) within PHP]]></description>
			<content:encoded><![CDATA[<p>This is not too easy. At <a href="http://incubator.apache.org/log4php/" target="_blank">Log4PHP</a> we have exactly that problem right now. Somebody is using the FileAppender and figured out, that one Apache process was waiting looong time before it could write. Reason: the logger locked the Logfile for the whole time of the request. If you have lots of requests, you can think what it means. Performance is past, in the case.</p>
<p>Time for me to think about the different options to write to log files.</p>
<p>I figured out, that I have to compare the following options:</p>
<p>1) Not closing the file while the whole request is running. This is not an option in a live system, but will give me a good idea whats currently the case</p>
<pre>$fp = fopen($file, 'a+');
while($count &lt; $loop) {
   fwrite($fp, $text);
}
fclose($fp);</pre>
<p>2) Closing the file directly after fwrite is called</p>
<pre>while($count &lt; $loop) {
   $fp = fopen($file, 'a+');
   fwrite($fp, $text);
   fclose($fp);
}</pre>
<p>3) Use file_put_contents, which is known as an alias to fopen, fwrite and fclose</p>
<pre>while($count &lt; $loop) {
   file_put_contents($file, $text, FILE_APPEND);
}</pre>
<p>4) Leave the file open while the whole request, but unlock it with flock and flock it again, when the next log event occurs</p>
<pre>$fp = fopen($file, 'a+');
flock($fp, LOCK_UN);
while($count &lt; $loop) {
   if (flock($fp, LOCK_EX)) {
      fwrite($fp, $text);
   }
   flock($fp, LOCK_UN);
}
fclose($fp);</pre>
<p>5) Use a nonblocking stream for this and flock</p>
<pre>$fp = fopen($file, 'a+');
stream_set_blocking($fp, 0);

while($count &lt; $loop) {
   if (flock($fp, LOCK_EX)) {
       fwrite($fp, $text);
   }
   flock($fp, LOCK_UN);
}
fclose($fp);</pre>
<p>6) Use the error_log method, which my friend <a href="http://blog.kevinhorst.de/" target="_blank">Kevin Horst</a> brought up</p>
<pre>while($count &lt; $loop) {
   error_log($text, 3, $file);
}</pre>
<p>For each of this options I wrote a simple function which wrote 10000 times 100 characters in  a freshly created log file. I measured before opening and after closing. Additionally I tried out with 2 seperated threads if the write access is nonblocking. Good thing is, option 2 to 6 are actually nonblocking. And here are the timing results:</p>
<p>1) Execution with NOT closing the log file took 0.0668561458588 seconds<br />
2) Execution with CLOSING the log after each write file took 30.1630220413 seconds<br />
3) Execution with file_put_content took 30.153963089 seconds<br />
4) Execution with leaving the file open, but LOCKING and UNLOCKING it took 0.148998975754 seconds<br />
5) Execution with nonblocking stream took 0.149605989456 seconds<br />
6) Execution with the error_log method took 30.069578886 seconds</p>
<p>Let&#8217;s see what it means.</p>
<p>Not closing the file until the 10000 fwrite calls are handled as actually the fastest. No surprise. It just took 0.0668 seconds but this one is not really an option, cause other threads have to wait until this request has been finished.</p>
<p>If you close the file after each fwrite and make it available to other threads and then reopen it, is hell. For 10000 calls of this kind I needed 30 seconds! It&#8217;s insane to have this in a productive system. The same goes with file_put_contents. Well, I allready knew (its in the php docs) that this method is nothing else then a wrapper for fopen, fwrite and fclose. Times are so similar that I say it&#8217;s exactly the same. Sometimes the one is some millis faster, sometimes the other.</p>
<p>If you open the file, unlock it with flock and flock it again it works very well. Just 0.14 ms for the 10000 fwrite calls. Thats the double amount of option 1, but yeah, here we do some more stuff. The interpreter cares about who is allowed to write, together with the OS. flock works that way, that a call to this function blocks until the requestor gets the actual lock. You can be sure that only one thread is actually writing.</p>
<p>Same goes to the nonblocking stream. This works with  stream_set_blocking($fp, 0);. The file stream is nonblocking, means each thread could write at it the same time. That no mess happens, we need an flock here too. That brings us to the nearly same results as fopen, flock, fwrite, flock, fclose option above. But looking at the logfiles of this one and option 4, this one looks more nice to me. This is just subjective, but it looks like the lock is shared more nicely between both threads.</p>
<p>Last one is the error_log method. It didn&#8217;t had any idea what to expect, but&#8230; 30 seconds! This one behaviours like a wrapper for fopen, fwrite and fclose, like file_put_content. No guys, this is not really a method enabled for logging! If one would use this in a framework like Log4PHP, that would be hell to performance. I would think that this should better removed out. The name suggests a good logging method, but this is not the case.</p>
<p>Having that all said, Log4PHP will get the lock and unlock option number 4. I feel good with it, since it&#8217;s quite straightforward. I don&#8217;t have too much expierence with the non blocking stream and don&#8217;t want to have this in a framework like log4php is.</p>
<p>However, Logging must be used carefully at all. I thnk on a system with 10000 request a second. Enabling logging into one file could bring the system down. I think a live system should have the option to log exactly one request. Maybe triggered by an url param. Think carefully what you log and how you configure your live system.</p>
<p>The complete script can be found <a href="http://blog.grobmeier.de/wp-content/uploads/2009/08/benchmark.php.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Adobe Wave &#8211; Objectoriented API, first draft</title>
		<link>http://www.grobmeier.de/2009/08/03/adobe-wave-objectoriented-api-first-draft.html</link>
		<comments>http://www.grobmeier.de/2009/08/03/adobe-wave-objectoriented-api-first-draft.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 07:34:34 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Adobe Wave]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=249</guid>
		<description><![CDATA[Build a little Adobe Wave Script]]></description>
			<content:encoded><![CDATA[<p>For a while Adobe catched my attention with their new product <a href="http://labs.adobe.com/technologies/wave/" target="_blank">Adobe Wave</a>. It&#8217;s basically Growl, but for websites. Means one can subscribe and a website publisher can notify you if some update happens. I realized that I like AIR, the enviroment of the Wave client. Looking at the examples I put together a simple Wave script, which lets you publish news on your feed.</p>
<p>I think I will use a similar script for pushing stuff with Log4PHP. I will propose that today on the mailinglist. Additionally I think about making a WordPress plugin for my own blog. We&#8217;ll see how fast I am <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Your comments are appreciated!</p>
<p><a href="http://grobmeier.de/custom/downloads/wave-api-0.1.zip" target="_blank">Here is the wave script</a>. Its released under Apache SL 2.0. Credits to the Wave team, I based everything on their examples. <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/08/03/adobe-wave-objectoriented-api-first-draft.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some words about unit testing &#8211; Junit, PhpUnit</title>
		<link>http://www.grobmeier.de/2009/05/27/some-words-about-unit-testing-junit-phpunit.html</link>
		<comments>http://www.grobmeier.de/2009/05/27/some-words-about-unit-testing-junit-phpunit.html#comments</comments>
		<pubDate>Wed, 27 May 2009 20:16:13 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=218</guid>
		<description><![CDATA[What is Unit testing?]]></description>
			<content:encoded><![CDATA[<h1>Unit Testing with Junit and PHPUnit</h1>
<p>All the worlds speaks about testdriven development and unit testing. But most people finishing there exams don&#8217;t have a clue about what this means. To be honest, I was surprised that people could get out of a university just with one or two Junit tests implemented. Well, here are some words about testing.</p>
<h2>What is a unit test?</h2>
<p>A unit test is nothing else than some lines of test code which tries to check out if the lines of business logic you wrote actually works. To help you with this, tools like JUnit and PHPUnit (or SimpleTest in PHP enviroment) have been written. They are frameworks which give you some methods to work with. To be clear: a unit test is some kind of class which instantiates another class and checks if the parameters you put in bring the correct results.</p>
<h2>What does testdriven development mean?</h2>
<p>Hardcore people say, before you write the business logic, you&#8217;ll have to write a test case. This is test driven development: write your test, then write the actual business logic. For me it works usually like this: I write my business logic and as soon as I have something cool working, I write a testcase. Sometimes it behaves a bit different. Depends on. But thats a matter of taste. As usual I recommend not to be to extreme about everything and just try out what is best for you.</p>
<h2>What and how much to test?</h2>
<p>Everything. Well, not really. A good testing ratio is at 70%. More does mean that you even test your exceptions, less means you have forgotten some classes. There are tools available which help you with checking out how much you have tested. In Javaworld its Cobertura, in PHP its Spike PHP Testcoverage, for example.</p>
<h2>How does a testcase look like?</h2>
<p>Usually you have to extend your tester class from a class called TestCase or similar. In PHPUnit its PHPUnit_Framework_TestCase. They make your classes executable in the testing enviroment. Then implement methods &#8211; all methods which implement an actual test is prefixed with test.</p>
<p>An example from Log4PHP:</p>
<pre>class LoggerLayoutHtmlTest extends PHPUnit_Framework_TestCase {
    public function testErrorLayout() {</pre>
<p>The testing frameworks usually look for methods like this and execute them one by one. In newer JUnit Versions you have to annotate testing methods. OK, and this is a valid PHP testcase:</p>
<pre>public function testErrorLayout() {
        $event = new LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
        $layout = new LoggerLayoutHtml();
        $v = $layout-&gt;format($event);
        $e = "blub";
        self::assertEquals($v, $e);
    }</pre>
<p>Again, its Log4PHP. I instantiate a class which I am intending to test and call a method on it. The result is stored in $v. What I expect is stored in $e. All testing frameworks provide you so called assert methods, which enable you to compare or check otherwise if the expectation meets the actual result. In my case, &#8220;blub&#8221; is expected. If this assertion fails, my tool shows me that error.</p>
<h2>Why is it necessary to keep old tests?</h2>
<p>If you change business logic or refactor something you can simply execute old tests and recognize if something goes wrong. People say, before putting an echo or System.out.prinln somewhere, write an test. I agree here. A good testing ratio makes your software stable and you take care of side effects, even when software grows. And before you deliver you run all your tests. This way you make sure that everything is fine.</p>
<h2>Test Data and dependend Tests</h2>
<p>To make it short, test methods should never depend on the success of  test methods. Each test method can be executed stand alone. Otherwise your life will be hell &#8211; think on thousand methods depending on each other. Same goes to test data. A testcase must not depend on data another test method created. This will cause you hell.</p>
<p>I know that this is very difficult  with databases. Testframeworks usually give you &#8220;tearUp&#8221; or &#8220;tearDown&#8221; methods which are called before a test method starts. You can create your testdata in the databases in these methods. But this is very time consuming. Test executions of this kind can easily take hours. Best is, keep your tables short, make a SQL file for each package or even each test case. There are no best practices which fits on each project.</p>
<p>In my last project we have used Excel (=Manager aware) to take care of the data and then generated SQL files out of it. Time consuming, complex, but it worked. The relations in this tables where to strong, we couldn&#8217;t keep the data care up otherwise.</p>
<h2>Testing helps coding</h2>
<p>Having said the above, you can imagine that you should think about testability BEFORE you code. Spaghetthi code isn&#8217;t testable. Make short methods. Keep in mind what &#8220;Separation of Concerns&#8221; means. Same goes to databases. Make them plugable. Not at all time foreign keys are good. Think about it twice &#8211; they are mighty but can be evil too. I have worked in projects where it was very heavy duty or even impossible to delete any data. If you write your application testable, its going to be good designed in much cases.</p>
<p>This doesn&#8217;t mean you should put all methods to public scope! Test cases should be in the same package as their Test classes are, so you can try to work with package scoped methods aswell. However, whatever you do, testable code is good, but it never should break encapsulation just for beeing testable.</p>
<p>In most cases private methods can be tested with the test of public methods. Test coverage tools help to identify test lacks.</p>
<h2>What to test? Again!</h2>
<p>Try to test all public methods! If you need to create files, use the tempfolder. Set up databases for the test. Use Jetty and HSQL if need it embedded &#8211; in PHP its PDO and SQLite. Don&#8217;t waste your time with testing exceptions which usually never happen. Just use 20% of your time to make 80% of tests! Try to test business logic &#8211; if that means the creation of complex objects, so be it. Maybe you can share the logic. But don&#8217;t get bored with testing getter and setters. Those are called thousand of times within normal tests or procedures, no need to do that.</p>
<h2>How much time can test development need??</h2>
<p>Calculate the same time as implemeting the testcase. Too much? Not really! Imagine you are writing business code for 5 hours. Thousands of outputs on the console you read manually. You delete it, check it in and later want to fix again. Put those outputs in again? Have commented it out? Code is ugly? Put all your stuff in a testcase. Nobody claims if you need 5 hours for it, if its done properly. Sometimes testcases need 3 days but the fix just 1 hour. This can happen in EAI enviroments, where multiple systems communicate. No problem here &#8211; these is business critical, automatic tests are the best you can do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/05/27/some-words-about-unit-testing-junit-phpunit.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Committing to Log4PHP</title>
		<link>http://www.grobmeier.de/2009/04/27/committing-to-log4php.html</link>
		<comments>http://www.grobmeier.de/2009/04/27/committing-to-log4php.html#comments</comments>
		<pubDate>Mon, 27 Apr 2009 05:44:50 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=199</guid>
		<description><![CDATA[Christian Grobmeier is now committing to Apache Incubator Log4PHP. Just several issues, then we should go ahead to a 1.0 release.]]></description>
			<content:encoded><![CDATA[<p>I just was off for a weekend to celebrate the wedding of good friends &#8211; and after returning I found myself beeing committer to Log4PHP. Well, OK, I wasn&#8217;t surprised since Gavin and I tried for over a month to get access to this repository. Finally we made it. <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Log4PHP is an api for logging within PHP applications. As the name suggests, it&#8217;s a port from Log4J which is todays standard in Java applications. Log4PHP has had several attempts to get running, but always went dry. It was february 2007 where lads kicked off the project again.</p>
<p>However, since I need this  Log4PHP as a dependency on <a href="http://piwi.googlecode.com">PIWI</a> I really don&#8217;t want to let it go. It has so much benefits to PIWI. And finally I don&#8217;t know a better logging tool than Log4J or its port Log4PHP is. Beside that Log4PHP is a great api, I think it will help to get PHP developers more attracted to Apache. This is important since there are so less PHP guys here. Apache Incubator <a href="http://incubator.apache.org/projects/shindig.html">Shindig</a> is the only project I know with a regular contribution for PHP. Well, hopefully we get a community back the next days and hopefully some of those users turn into fullfledget committers too. We&#8217;ll see.</p>
<p>It&#8217;s some stuff todo. Nothing critical, just some design issues, small errors and some todos. I guess, we can work on a 1.0 once those issues are resolved. We&#8217;ll see <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Here are some links for further reading:<a href="https://issues.apache.org/jira/browse/LOG4PHP" target="_blank"></a></p>
<p><a href="http://incubator.apache.org/log4php/">http://incubator.apache.org/</a><a href="https://issues.apache.org/jira/browse/LOG4PHP" target="_blank">log4php/</p>
<p>https://issues.apache.org/jira/browse/LOG4PHP</a></p>
<p><a href="http://incubator.apache.org/projects/log4php.html" target="_blank">http://incubator.apache.org/projects/log4php.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/04/27/committing-to-log4php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
