I think its [appenders][params][files] but its early and I haven't finished my 
coffee but you get the general idea. I was the array config was a little better 
documented but alas I haven't had the time to contribute.

From: Kavin Mehta [mailto:[email protected]]
Sent: Tuesday, July 31, 2012 4:45 PM
To: Log4PHP User
Subject: Re: How to dynamically change the file name of log file

Thanks Mike!!

Now, to change it you have access to the $logConfig array in your script? so 
something like  $logConfig [appenders][default][layout][params][file] = 
'C:\asdasd.log' should change the log file?

Pardon me if this is a silly question, but i am a noob, both in php & the 
logger.

Thanks,
Kavin

On Tue, Jul 31, 2012 at 12:31 PM, Michael Sole 
<[email protected]<mailto:[email protected]>> wrote:
This is what I am using now:
//Logging config
        $logConfig = array(
                    'appenders' => array(
                        'default' => array(
                            'class' => 'LoggerAppenderRollingFile',
                            'layout' => array(
                                'class' => 'LoggerLayoutTTCC',
                            ),
                            'params' => array(
                                'file' => BASE_APP_PATH.'log/'.$db.'.log',
                                'maxFileSize' => '1MB',
                                'maxBackupIndex' => 5,
                            ),
                        ),
                    ),
                    'rootLogger' => array(
                        'level'=>'WARN',
                        'appenders' => array('default'),
                    ),
                );

        Logger::configure($logConfig);
        $log = Logger::getLogger('myLogger');

From: Kavin Mehta [mailto:[email protected]<mailto:[email protected]>]
Sent: Tuesday, July 31, 2012 1:03 PM
To: Log4PHP User
Subject: Re: How to dynamically change the file name of log file

Thanks Mike. Appreciate the quick response.

Can you give me an example?

Thanks,
Kavin Mehta.

On Tue, Jul 31, 2012 at 6:13 AM, Michael Sole 
<[email protected]<mailto:[email protected]>> wrote:
Kavin,

If you use the array config method you can set the file dynamically. This is 
what I am doing.

Mike

From: Kavin Mehta [mailto:[email protected]<mailto:[email protected]>]
Sent: Monday, July 30, 2012 7:45 PM
To: [email protected]<mailto:[email protected]>
Subject: How to dynamically change the file name of log file

Hi,

I am using a relative path for the name of the log file in my appender. I am 
using <param name="file" value="../admin/logging/log4php.log" />. I find this 
more helpful then an absolute path, because our developers work across 
different OS systems. I was wondering if there is a way to change this setting 
dynamically or may give it some variable name?

Thanks,
NooB


Reply via email to