Quantcast

Zend_Log factory() proposition

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Zend_Log factory() proposition

Martin Roest - Ibuildings
Hi,

I'd like to do a proposition for a factory method in the Zend_Log that allows easy creation and configuration of the Zend_Log object.

For example you have more than one logger and you want to be able to easily enable/disable the writers separately. Often we use multiple environments like staging, integration and production. ie. I want to write to a log file on production but disable the firePHP logging.

Now we have something like this in our config.ini file:

debug.log.file.class = "Zend_Log_Writer_Stream"
debug.log.file.config.uri = "/<path>/<to>/application.log"
debug.log.file.enabled = true
debug.log.firebug.class = "Zend_Log_Writer_Firebug"
debug.log.firebug.params = ""
debug.log.firebug.enabled = false

From that we create a Zend_Config object and passes it to a factory method that will create the Zend_Log object.

If find myself doing this for every project and it would be nice if we could incorporate it in the Zend_Log itself. To make it work we need to change a little bit in the stream writer but it can be kept backwards compatible.

Its kinda similar to what is used with Zend_db.

I'd happy to build it and provide patches.


Let me know what you guys think.


Regards,
--
Ibuildings [i]
THE PHP PROFESSIONALS

Martin Roest
Professional Services Consultant
(Zend PHP5 Certified Engineer)
(MySQL 5 Certified Developer)


phone (direct): +31 (0) 88 00 24 059
mobile: +31 (0) 6 28 55 67 83
skype: <a style="color: rgb(177, 21, 35) ! important; text-decoration: none ! important;" href="callto://mroest">mroest
e-mail: [hidden email]

phone: +31 (0) 88 00 24 000
www.ibuildings.nl

To all agreements with Ibuildings.nl BV, our general terms and conditions apply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend_Log factory() proposition

weierophinney
Administrator
-- Martin Roest - Ibuildings <[hidden email]> wrote
(on Tuesday, 23 September 2008, 05:14 PM +0200):

> I'd like to do a proposition for a factory method in the Zend_Log that allows
> easy creation and configuration of the Zend_Log object.
>
> For example you have more than one logger and you want to be able to easily
> enable/disable the writers separately. Often we use multiple environments like
> staging, integration and production. ie. I want to write to a log file on
> production but disable the firePHP logging.
>
> Now we have something like this in our config.ini file:
>
> debug.log.file.class = "Zend_Log_Writer_Stream"
> debug.log.file.config.uri = "/<path>/<to>/application.log"
> debug.log.file.enabled = true
> debug.log.firebug.class = "Zend_Log_Writer_Firebug"
> debug.log.firebug.params = ""
> debug.log.firebug.enabled = false
>
> From that we create a Zend_Config object and passes it to a factory method that
> will create the Zend_Log object.
>
> If find myself doing this for every project and it would be nice if we could
> incorporate it in the Zend_Log itself. To make it work we need to change a
> little bit in the stream writer but it can be kept backwards compatible.
>
> Its kinda similar to what is used with Zend_db.
>
> I'd happy to build it and provide patches.
>
> Let me know what you guys think.

Martin -- as we discussed at ZendCon, this sounds good.

To proceed, first, make sure you have signed up for an account on the
wiki, and that you have permissions to create pages; ping me if you
don't, and I'll get you setup.

Then, create a proposal on the wiki:

    http://framework.zend.com/wiki/display/ZFPROP/Home

Once all details are complete, reparent it to "Ready for Review" to get
community feedback. After 1 - 2 weeks, and after you've incorporated any
good feedback, reparent it to "Ready for Recommendation", and the
internal team will review and (hopefully) approve.

Thanks in advance for the contribution!

--
Matthew Weier O'Phinney
Software Architect       | [hidden email]
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend_Log factory() proposition

Benjamin Eberlei-2
In reply to this post by Martin Roest - Ibuildings
On Tuesday 23 September 2008 17:14:18 Martin Roest - Ibuildings wrote:

> Hi,
>
> I'd like to do a proposition for a factory method in the Zend_Log that
> allows easy creation and configuration of the Zend_Log object.
>
> For example you have more than one logger and you want to be able to
> easily enable/disable the writers separately. Often we use multiple
> environments like staging, integration and production. ie. I want to
> write to a log file on production but disable the firePHP logging.
>
> Now we have something like this in our config.ini file:
>
> debug.log.file.class = "Zend_Log_Writer_Stream"
> debug.log.file.config.uri = "/<path>/<to>/application.log"
> debug.log.file.enabled = true
> debug.log.firebug.class = "Zend_Log_Writer_Firebug"
> debug.log.firebug.params = ""
> debug.log.firebug.enabled = false
>
> >From that we create a Zend_Config object and passes it to a factory
>
> method that will create the Zend_Log object.
>
> If find myself doing this for every project and it would be nice if we
> could incorporate it in the Zend_Log itself. To make it work we need to
> change a little bit in the stream writer but it can be kept backwards
> compatible.
>
> Its kinda similar to what is used with Zend_db.
>
> I'd happy to build it and provide patches.
>
>
> Let me know what you guys think.
>
>
> Regards,

This sounds like a great addition to Zend_Log, you'll get my thumbs up on
this. constructing the logger is somewhat tedious at the moment.

--
Benjamin Eberlei
http://www.beberlei.de
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend_Log factory() proposition

Martin Roest - Ibuildings

This sounds like a great addition to Zend_Log, you'll get my thumbs up on 
this. constructing the logger is somewhat tedious at the moment.

  


It took me some time due to my schedule but the proposal is online.


If you're interested please take a look at and let me know.

http://framework.zend.com/wiki/display/ZFPROP/Zend_Log+factory()+-+Martin+Roest


Thanks!
--
Ibuildings [i]
THE PHP PROFESSIONALS

Martin Roest
Professional Services Consultant
(Zend PHP5 Certified Engineer)
(MySQL 5 Certified Developer)


phone (direct): +31 (0) 88 00 24 059
mobile: +31 (0) 6 28 55 67 83
skype: <a style="color: rgb(177, 21, 35) ! important; text-decoration: none ! important;" href="callto://mroest">mroest
e-mail: [hidden email]

phone: +31 (0) 88 00 24 000
www.ibuildings.nl

To all agreements with Ibuildings.nl BV, our general terms and conditions apply.
Loading...