Hi Andrew,
> Some of these settings need to be changed on the fly by end users (log
> level), and I'd like to store these properties in the database.
first which came into my mind was that you probably need to write a
configurator. If you look into the configurators folder, you'll see
LoggerConfiguratorIni / XML etc.. If you want to configure out from a
database, then you'll probably want to implement the
LoggerConfigurator interface.
This is for "per request changes".
> Right now I can set loglevel dynamically. I can not determine how to set
> other properties dynamically though. Documentation on the configuration of
> log4php is almost exclusively done via properties/xml files - though it says
> all settings can be changed programmatically.
I think you are now speaking of "change properties within one single
request". In that case you probably want to do something like this
(out of my mind, not a clue if it works :-)):
$logger = Logger::getLogger('myLogger');
$appender = $l->getAppender('yourappendersname');
// assuming that you want to do somehting on a mail appender
$appender->setSubject('new subject');
You also could do:
$logger->setLevel(...);
> To clarify - I do NOT want to use configuration files, as the end users will
> not have direct access to these. I will provide a front end to change
> certain logging settings, and all settings will be stored in the database.
OK - if you are accepting that changes can be done "per request" only,
then you should go with a configurator implementation.
> Where can I find documentation on how to set various aspects of the logging
> within the program?
Besides online docs, there is only sourcecode. Please let me know if a
Configurator does help you. On this list you will get help if you
need some more.
Best,
Christian
>
> Thank you,
>
> Andrew Wegner
>
>