0

I've downloaded the log4php and created a module named logger that will serve as a singleton reference for my skeleton zend 2 framework application. In application.config I registered the module "Logger" and have the following structure for my application:

  • module

    • Other Modules "will use Logger"
    • Logger

      • config
        • module.config.php
      • src
        • log4php "renamed from php" code from log4php community

      module.php

      autoload_classmap.php

module.config.php has:

    "return array(
$options = array(
  'writers' => array(
        array(
            'name' => 'stream',
            'stream' => 'php://output',
            'formatter' => 'simple',
        ),
        array(
            'name' => 'stream',
            'stream' => 'application.log',
            'formatter' => array(
                'name' => 'simple',
                'options' => array(
                    'format' => '%timestamp%'
                ),
            ),
            'filters' => array(
                array(
                    'name' => 'priority',
                    'options'  => array(
                        'priority' => Logger::WARN
                    ),
                ),
            ),
        ),
    ),
),

);"

moudle.php has: "getConfig() and getAutoloaderConfig() with 'Logger' => DIR . '/src/log4php/' . 'Logger"

autoload_classmap.php "returns area();"

QUESTION:

How can I auto register and use my "Logger" module. Any suggestions would be helpful, thanks!

  • It's not very clear what the issue is. What you've posted looks fine - what do you mean by "auto register" the module? How would you want to be able to use this logger class in your application, and what have you tried? – Tim Fountain Feb 20 '14 at 12:41
  • You've used the term "registering" again and I don't know what you mean by that. Are you unable to use your logger class elsewhere in your application, and if so what error are you getting? What are you expecting to happen with the code you have? – Tim Fountain Feb 20 '14 at 15:20
  • Register with zend framework 2 auto load module service. Yes, I am unable to use the logger class. I am not getting errors just nothing happens. What I would like to happen is print to console or write to a file, either one will do to get started. Thanks! – user2436826 Feb 20 '14 at 15:42
  • I was able to resolve it by manually adding the log4php requirement under composer and doing a self update. Thanks for your help though! – user2436826 Feb 20 '14 at 18:52

0 Answers0