Hi Christian, > Do you already have a policy on which problems an exception may be thrown > to the application (which most likely will cause its termination) and which > ones should be silently ignored?
not yet. We discussed n the past that we need to speak about Exception Handling once Log4PHP is cleaned up. Now it is and the time is right for such discussions like discussions about API design. > For example, I found it very annoying to have found yet another case where > log4php simply did nothing and I had to debug deep down until I realized that > this time there was a typo in the SQL string. Definitly! We have LoggerException which is currently completly unused. This exception has been introduced before a few months when we discussed to disable the internal logging. > This is a patch for enabling the Exception mode: Thanks, I will review it later > My proposal would be to let PDO throw an Exception but at least to try a > reconnect if the current link has gone (which means that the application wont > die just because somebody restarted the database server). Log4perl does it > the same way. I think that approach is a good one. There are more places in which we could use exceptions. We need to speak more generally about this. I would propose that we throw exceptions if: - log4php exception mode is turned on (should be on by default, some kind of property) - something technically went wrong, like db connect failed, property file is corrupt or similar - if something logical is wrong, it should NOT throw an exception - i think on forgetting an configuration thing. An application should not break if an admin needs to enable debugging on a production app and forgot to add an appender or something like that. > As PDO has nothing like "mysql_ping()" and the > getAttribute(PDO::ATTR_CONNECTION_STATUS) does not give the current status, > a custom exception handler or some try/catches could be used... I try a bit > around if I find something suitable. cool thanks. mysql_ping or similar is made in different connection pooling system in java world with some kind of "select 1 from system_table", means, some kind of specific sql query which always has success. Maybe that can help to avoid db specific method signatures. CHeers, Christian > > bye, > > -christian- > >
