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 "Ivan Habunek (JIRA)" <ji...@apache.org> on 2010/05/16 14:32:43 UTC

[jira] Created: (LOG4PHP-116) A rewrite of LoggerConfiguratorXML

A rewrite of LoggerConfiguratorXML
----------------------------------

                 Key: LOG4PHP-116
                 URL: https://issues.apache.org/jira/browse/LOG4PHP-116
             Project: Log4php
          Issue Type: Improvement
          Components: Code
            Reporter: Ivan Habunek


As discussed on the mailing list, it was decided that the LoggerConfiguratorXML would benefit from a rewrite. This is a full rewrite of the class using PHP's SimpleXML extension for parsing XML. 
(http://www.php.net/manual/en/book.simplexml.php)

The new implementation gives the following benefits compared to the current implementation:
* The code is cleaner and much more readable.
* The code executes in a more linear fashion, instead of an "infinite loop"
* The elements in the XML configuration are not parsed in the order they are written, therefore the order of elements is no longer important. Well, this is not entirely true, the order of parameters might be important for for some appenders or other components, but this is not a Configurator issue and has to be solved in the said components.
* Implemented internal error logging and debugging. Makes it easier for end user to diagnose problems with the configuration.

LoggerLog class was reinstated to facilitate internal logging. It is very simple, it has 3 logging methods: debug(), error() and warn(). These methods use the PHP function trigger_error for logging (with appropreate error types: E_USER_NOTICE for debug, E_USER_WARNING for warn and E_USER_ERROR for error messages). Error and warning level messages are enabled by default. Debug level are disabled by default, but can be enabled by:
* calling LoggerLog::setInternalDebugging(true)
* specifying debug="true" in root element of XML config file
* setting the environment variable log4php.debug=true

Additionally, the following changes were made to complement the above changes:
* LoggerOptionConverter::getSystemProperty was modified to check getenv($key) as well as $_ENV[$key], because $_ENV global array is sometimes not populated depending on the settings in php.ini (see variables_order directive in http://php.net/manual/en/ini.core.php).
* Implemented the __toString method in LoggerLevel. This allows for easier logging of levels, e.g. debug("Setting level to $level") where $level is an instance of LoggerLevel.

Note that the debug mode is quite verbose, I tried to show the order in which settings are parsed, and state if any setting was ignored and why.

Please try out and state your opinion. :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4PHP-116) A rewrite of LoggerConfiguratorXML

Posted by "Christian Grobmeier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4PHP-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869502#action_12869502 ] 

Christian Grobmeier commented on LOG4PHP-116:
---------------------------------------------

As usual a very good patch :-) I like the new processing of xml much and we should work on this as basis.

I also feel that we should do a 2.1 release very soon. This patch is huge and I would like to view at it mre in detail so my proposal would be to include this in a 2.2 release.

Ok, on code: 
- you are using the error_get_last method. Please look at the brandnew issue LOG4PHP-117 which describes problems with this method

- I am not a fan of LoggerLog. We have deleted it because Log4PHP should be so easy that it doesn't need an internal logging. Debugging a logging framework should not be necessary. That being said, what are the reasons to include this? Imho we should discuss more on making everything easier and a better way to deal with misconfiguration and such on the list. Hopefully others raise their voices on this too

- I really love the __toString implementation. That was a good idea
- same for getSystemProperty

Anyway thanks for this one again!


> A rewrite of LoggerConfiguratorXML
> ----------------------------------
>
>                 Key: LOG4PHP-116
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-116
>             Project: Log4php
>          Issue Type: Improvement
>          Components: Code
>            Reporter: Ivan Habunek
>         Attachments: LoggerConfiguratorXML.rewrite.patch
>
>
> As discussed on the mailing list, it was decided that the LoggerConfiguratorXML would benefit from a rewrite. This is a full rewrite of the class using PHP's SimpleXML extension for parsing XML. 
> (http://www.php.net/manual/en/book.simplexml.php)
> The new implementation gives the following benefits compared to the current implementation:
> * The code is cleaner and much more readable.
> * The code executes in a more linear fashion, instead of an "infinite loop"
> * The elements in the XML configuration are not parsed in the order they are written, therefore the order of elements is no longer important. Well, this is not entirely true, the order of parameters might be important for for some appenders or other components, but this is not a Configurator issue and has to be solved in the said components.
> * Implemented internal error logging and debugging. Makes it easier for end user to diagnose problems with the configuration.
> LoggerLog class was reinstated to facilitate internal logging. It is very simple, it has 3 logging methods: debug(), error() and warn(). These methods use the PHP function trigger_error for logging (with appropreate error types: E_USER_NOTICE for debug, E_USER_WARNING for warn and E_USER_ERROR for error messages). Error and warning level messages are enabled by default. Debug level are disabled by default, but can be enabled by:
> * calling LoggerLog::setInternalDebugging(true)
> * specifying debug="true" in root element of XML config file
> * setting the environment variable log4php.debug=true
> Additionally, the following changes were made to complement the above changes:
> * LoggerOptionConverter::getSystemProperty was modified to check getenv($key) as well as $_ENV[$key], because $_ENV global array is sometimes not populated depending on the settings in php.ini (see variables_order directive in http://php.net/manual/en/ini.core.php).
> * Implemented the __toString method in LoggerLevel. This allows for easier logging of levels, e.g. debug("Setting level to $level") where $level is an instance of LoggerLevel.
> Note that the debug mode is quite verbose, I tried to show the order in which settings are parsed, and state if any setting was ignored and why.
> Please try out and state your opinion. :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LOG4PHP-116) A rewrite of LoggerConfiguratorXML

Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Habunek updated LOG4PHP-116:
---------------------------------

    Attachment: LoggerConfiguratorXML.rewrite.patch

> A rewrite of LoggerConfiguratorXML
> ----------------------------------
>
>                 Key: LOG4PHP-116
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-116
>             Project: Log4php
>          Issue Type: Improvement
>          Components: Code
>            Reporter: Ivan Habunek
>         Attachments: LoggerConfiguratorXML.rewrite.patch
>
>
> As discussed on the mailing list, it was decided that the LoggerConfiguratorXML would benefit from a rewrite. This is a full rewrite of the class using PHP's SimpleXML extension for parsing XML. 
> (http://www.php.net/manual/en/book.simplexml.php)
> The new implementation gives the following benefits compared to the current implementation:
> * The code is cleaner and much more readable.
> * The code executes in a more linear fashion, instead of an "infinite loop"
> * The elements in the XML configuration are not parsed in the order they are written, therefore the order of elements is no longer important. Well, this is not entirely true, the order of parameters might be important for for some appenders or other components, but this is not a Configurator issue and has to be solved in the said components.
> * Implemented internal error logging and debugging. Makes it easier for end user to diagnose problems with the configuration.
> LoggerLog class was reinstated to facilitate internal logging. It is very simple, it has 3 logging methods: debug(), error() and warn(). These methods use the PHP function trigger_error for logging (with appropreate error types: E_USER_NOTICE for debug, E_USER_WARNING for warn and E_USER_ERROR for error messages). Error and warning level messages are enabled by default. Debug level are disabled by default, but can be enabled by:
> * calling LoggerLog::setInternalDebugging(true)
> * specifying debug="true" in root element of XML config file
> * setting the environment variable log4php.debug=true
> Additionally, the following changes were made to complement the above changes:
> * LoggerOptionConverter::getSystemProperty was modified to check getenv($key) as well as $_ENV[$key], because $_ENV global array is sometimes not populated depending on the settings in php.ini (see variables_order directive in http://php.net/manual/en/ini.core.php).
> * Implemented the __toString method in LoggerLevel. This allows for easier logging of levels, e.g. debug("Setting level to $level") where $level is an instance of LoggerLevel.
> Note that the debug mode is quite verbose, I tried to show the order in which settings are parsed, and state if any setting was ignored and why.
> Please try out and state your opinion. :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LOG4PHP-116) A rewrite of LoggerConfiguratorXML

Posted by "Christian Grobmeier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Grobmeier updated LOG4PHP-116:
----------------------------------------

        Fix Version/s: 2.2
    Affects Version/s: 2.0
                       2.1

> A rewrite of LoggerConfiguratorXML
> ----------------------------------
>
>                 Key: LOG4PHP-116
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-116
>             Project: Log4php
>          Issue Type: Improvement
>          Components: Code
>    Affects Versions: 2.0, 2.1
>            Reporter: Ivan Habunek
>             Fix For: 2.2
>
>         Attachments: LoggerConfiguratorXML.rewrite.patch
>
>
> As discussed on the mailing list, it was decided that the LoggerConfiguratorXML would benefit from a rewrite. This is a full rewrite of the class using PHP's SimpleXML extension for parsing XML. 
> (http://www.php.net/manual/en/book.simplexml.php)
> The new implementation gives the following benefits compared to the current implementation:
> * The code is cleaner and much more readable.
> * The code executes in a more linear fashion, instead of an "infinite loop"
> * The elements in the XML configuration are not parsed in the order they are written, therefore the order of elements is no longer important. Well, this is not entirely true, the order of parameters might be important for for some appenders or other components, but this is not a Configurator issue and has to be solved in the said components.
> * Implemented internal error logging and debugging. Makes it easier for end user to diagnose problems with the configuration.
> LoggerLog class was reinstated to facilitate internal logging. It is very simple, it has 3 logging methods: debug(), error() and warn(). These methods use the PHP function trigger_error for logging (with appropreate error types: E_USER_NOTICE for debug, E_USER_WARNING for warn and E_USER_ERROR for error messages). Error and warning level messages are enabled by default. Debug level are disabled by default, but can be enabled by:
> * calling LoggerLog::setInternalDebugging(true)
> * specifying debug="true" in root element of XML config file
> * setting the environment variable log4php.debug=true
> Additionally, the following changes were made to complement the above changes:
> * LoggerOptionConverter::getSystemProperty was modified to check getenv($key) as well as $_ENV[$key], because $_ENV global array is sometimes not populated depending on the settings in php.ini (see variables_order directive in http://php.net/manual/en/ini.core.php).
> * Implemented the __toString method in LoggerLevel. This allows for easier logging of levels, e.g. debug("Setting level to $level") where $level is an instance of LoggerLevel.
> Note that the debug mode is quite verbose, I tried to show the order in which settings are parsed, and state if any setting was ignored and why.
> Please try out and state your opinion. :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4PHP-116) A rewrite of LoggerConfiguratorXML

Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4PHP-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12872157#action_12872157 ] 

Ivan Habunek commented on LOG4PHP-116:
--------------------------------------

Just back from vacation and ready to continue work on this one. :)

As a developer I like the debug messages. They show you exactly what's being done. That said, I agree that most users probably won't ever use these. It is probably sufficient just to issue warnings when a bit of configuration cannot be parsed. Do you propose then to remove all debug messages, and leave just errors and warnings?

I had a look at #LOG4PHP-117, and I think that the problem does not lie in error_get_last(), but in the way it is used in that particular case. I think there should not be any problems with this implementation.

I think it's a good idea to leave this for 2.2 to allow time for code review. I would welcome other developers' feedback on this issue as well.

> A rewrite of LoggerConfiguratorXML
> ----------------------------------
>
>                 Key: LOG4PHP-116
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-116
>             Project: Log4php
>          Issue Type: Improvement
>          Components: Code
>    Affects Versions: 2.0, 2.1
>            Reporter: Ivan Habunek
>             Fix For: 2.2
>
>         Attachments: LoggerConfiguratorXML.rewrite.patch
>
>
> As discussed on the mailing list, it was decided that the LoggerConfiguratorXML would benefit from a rewrite. This is a full rewrite of the class using PHP's SimpleXML extension for parsing XML. 
> (http://www.php.net/manual/en/book.simplexml.php)
> The new implementation gives the following benefits compared to the current implementation:
> * The code is cleaner and much more readable.
> * The code executes in a more linear fashion, instead of an "infinite loop"
> * The elements in the XML configuration are not parsed in the order they are written, therefore the order of elements is no longer important. Well, this is not entirely true, the order of parameters might be important for for some appenders or other components, but this is not a Configurator issue and has to be solved in the said components.
> * Implemented internal error logging and debugging. Makes it easier for end user to diagnose problems with the configuration.
> LoggerLog class was reinstated to facilitate internal logging. It is very simple, it has 3 logging methods: debug(), error() and warn(). These methods use the PHP function trigger_error for logging (with appropreate error types: E_USER_NOTICE for debug, E_USER_WARNING for warn and E_USER_ERROR for error messages). Error and warning level messages are enabled by default. Debug level are disabled by default, but can be enabled by:
> * calling LoggerLog::setInternalDebugging(true)
> * specifying debug="true" in root element of XML config file
> * setting the environment variable log4php.debug=true
> Additionally, the following changes were made to complement the above changes:
> * LoggerOptionConverter::getSystemProperty was modified to check getenv($key) as well as $_ENV[$key], because $_ENV global array is sometimes not populated depending on the settings in php.ini (see variables_order directive in http://php.net/manual/en/ini.core.php).
> * Implemented the __toString method in LoggerLevel. This allows for easier logging of levels, e.g. debug("Setting level to $level") where $level is an instance of LoggerLevel.
> Note that the debug mode is quite verbose, I tried to show the order in which settings are parsed, and state if any setting was ignored and why.
> Please try out and state your opinion. :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.