Log4php
  1. Log4php
  2. LOG4PHP-56

Replace define('LOG4PHP_CONFIGURATION' by static variable

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.0.0
    • Component/s: Code
    • Labels:
      None

      Description

      As you're currently switching to PHP5 OOP code, I would suggest to replace this ugly global constant by a static attribute of the LogManager class i.e. LogManager::$configFile = ... Or maybe even a constructor/factory argument
      This would have the additional benefit that it could be set by some kind of Dependency Injection framework like Spring for Java, although I don't know of such is even existing for PHP But it might come in the future.

        Activity

        Hide
        Christian Grobmeier added a comment -

        Thanks, will replace this var.

        About DI: I implemented such a lib within PIWI: piwi.googlecode.com
        I am not sure if that would be good, since PIWI isn't an Apache Project (yet - i am working on it). However, this should be considered.
        Thanks!

        Show
        Christian Grobmeier added a comment - Thanks, will replace this var. About DI: I implemented such a lib within PIWI: piwi.googlecode.com I am not sure if that would be good, since PIWI isn't an Apache Project (yet - i am working on it). However, this should be considered. Thanks!
        Hide
        Christian Grobmeier added a comment -

        The corresponding fields in Log4J from:

        LOG4PHP_DEFAULT_INIT_OVERRIDE
        LOG4PHP_CONFIGURATION
        LOG4PHP_CONFIGURATOR_CLASS

        are marked deprecated and for internal use only in Log4j 1.2.

        I think removing the properties and having:
        Logger::setConfigurationClass(Configurator $class)
        Logger::setConfiguration($pathToConfiguration)

        A initializer could be put too, but I think this feature isn't really worth having it: one can override the class, if he wants too.

        Show
        Christian Grobmeier added a comment - The corresponding fields in Log4J from: LOG4PHP_DEFAULT_INIT_OVERRIDE LOG4PHP_CONFIGURATION LOG4PHP_CONFIGURATOR_CLASS are marked deprecated and for internal use only in Log4j 1.2. I think removing the properties and having: Logger::setConfigurationClass(Configurator $class) Logger::setConfiguration($pathToConfiguration) A initializer could be put too, but I think this feature isn't really worth having it: one can override the class, if he wants too.
        Hide
        Christian Grobmeier added a comment -

        resolved in trunk

        Show
        Christian Grobmeier added a comment - resolved in trunk

          People

          • Assignee:
            Unassigned
            Reporter:
            Christian Hammers
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development