Logging and PSR-3

171 views
Skip to first unread message

Andrew Eddie

unread,
Mar 2, 2013, 3:12:23 AM3/2/13
to JPlatform
I just want to get an opinion on what to do with the old JLog in the Framework and PSR-3.

Firstly, I think it's worth the FW using PSR-3 in terms of consuming loggers. But that means we should upgrade Log to use it. The downside is there is enough difference between the way we do a log message and how PSR-3 expects you to do it that we'll end up refactoring the whole package.

We have some really nice things in our Log like being able to listen to different types of categories and log to different places. But, we'd loose our "category" if we go PSR-3. On the other hand, PSR-3 probably treats the message and variable injection more cleanly.

So I'm not quite sure what we should do.

We could continue with Log and ignore PSR-3.

We could retrofit Log with PSR-3 but sacrifice some features.

We could remove the Log package altogether and just let dev's use Monolog or something else.

Or maybe there's some ground in between.

Thoughts?

Regards,
Andrew Eddie

Niels Braczek

unread,
Mar 2, 2013, 9:10:28 AM3/2/13
to joomla-de...@googlegroups.com
Am 02.03.2013 09:12, schrieb Andrew Eddie:

> We have some really nice things in our Log like being able to listen to
> different types of categories and log to different places. But, we'd loose
> our "category" if we go PSR-3. On the other hand, PSR-3 probably treats the
> message and variable injection more cleanly.

PSR-3 does not force anyone to drop functionality: "Every method accepts
an array as context data. This is meant to hold any extraneous
information that does not fit well in a string. The array can contain
anything."

As a PHP-FIG voting member project, Joomla is supposed to follow the
standards.

Regards,
Niels

--
| http://barcamp-wk.de · 2. Barcamp Westküste 15./16. März 2013 |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------

Mike van Riel

unread,
Mar 2, 2013, 9:45:02 AM3/2/13
to joomla-de...@googlegroups.com
On 02.03.2013 15:10, Niels Braczek wrote:
> Am 02.03.2013 09:12, schrieb Andrew Eddie:
>
>> We have some really nice things in our Log like being able to listen
>> to
>> different types of categories and log to different places. But, we'd
>> loose
>> our "category" if we go PSR-3. On the other hand, PSR-3 probably
>> treats the
>> message and variable injection more cleanly.
>
> PSR-3 does not force anyone to drop functionality: "Every method
> accepts
> an array as context data. This is meant to hold any extraneous
> information that does not fit well in a string. The array can contain
> anything."

This is correct, PSR-3 is constructed in such a way that it allows you
to
provide additional meta-data specific to your application's need.

> As a PHP-FIG voting member project, Joomla is supposed to follow the
> standards.

Please allow me to rephrase that: Joomla is encouraged to follow the
recommendations.

Every PHP-FIG member project is allowed to ignore a recommendation if
they desire so, although it is appreciated, encouraged and in cases of
PSR-0, PSR-1 and PSR-3 perhaps even desirable to follow them.

My apologies for being pedantic here, the nuance matters to me.

Niels Braczek

unread,
Mar 2, 2013, 1:43:17 PM3/2/13
to joomla-de...@googlegroups.com
That's ok :). I should have made it more clear, that I'm expressing my
personal oppinion only.

Florian Voutzinos

unread,
Mar 2, 2013, 2:23:33 PM3/2/13
to joomla-de...@googlegroups.com
Hello,

I would delete JLog and let people use external PSR3 compatible libs like Monolog.

I don't think it's a good idea to rewrite JLog with our 4-5 handlers and spend time maintaining it vs the 10+ handlers of Monolog which is already actively maintained.

It's an other thing but PHPMailer should move away too, I mean there are much better implementations like Zend\Mail which are not difficult to use and well maintained/documented (http://framework.zend.com/manual/2.1/en/modules/zend.mail.introduction.html).

Regards,

Florian

Andrew Eddie

unread,
Mar 2, 2013, 3:15:00 PM3/2/13
to JPlatform


Regards,
Andrew Eddie
http://learn.theartofjoomla.comfree tutorials and videos on Joomla development


On 3 March 2013 05:23, Florian Voutzinos <voutzino...@gmail.com> wrote:
Hello,

I would delete JLog and let people use external PSR3 compatible libs like Monolog.

That's the option I'm leaning towards. See:

 
I don't think it's a good idea to rewrite JLog with our 4-5 handlers and spend time maintaining it vs the 10+ handlers of Monolog which is already actively maintained.

Agree. Would we include the Log package in V1.0 of the FW or just drop it?
 
It's an other thing but PHPMailer should move away too, I mean there are much better implementations like Zend\Mail which are not difficult to use and well maintained/documented (http://framework.zend.com/manual/2.1/en/modules/zend.mail.introduction.html).

We've already dropped mail from the FW.

Regards,
Andrew Eddie 

Andrew Eddie

unread,
Mar 2, 2013, 3:18:21 PM3/2/13
to JPlatform
On 3 March 2013 00:45, Mike van Riel <mike.v...@naenius.com> wrote:
This is correct, PSR-3 is constructed in such a way that it allows you to
provide additional meta-data specific to your application's need.

Yes, but there is no guarantee that a PSR-3 will know how to handle your custom metadata. Monolog would not know anything about our "category". That was the point I was trying to make.
 
As a PHP-FIG voting member project, Joomla is supposed to follow the
standards.

Please allow me to rephrase that: Joomla is encouraged to follow the
recommendations.

Every PHP-FIG member project is allowed to ignore a recommendation if
they desire so, although it is appreciated, encouraged and in cases of
PSR-0, PSR-1 and PSR-3 perhaps even desirable to follow them.

My apologies for being pedantic here, the nuance matters to me.

Yes, the nuance is important and misunderstood, even by FIG members. But I started this thread because I do want the FW to work with PSR-3 "somehow" :)

Regards,
Andrew Eddie 

Ronni KC

unread,
Mar 2, 2013, 3:28:19 PM3/2/13
to joomla-de...@googlegroups.com
Lets go with monolog and spend our time on more important wheel to (re)invent :)

Florian Voutzinos

unread,
Mar 2, 2013, 3:35:21 PM3/2/13
to joomla-de...@googlegroups.com
I think we should drop it from the framework, otherwise it can be confusing (ie. people don't know what to use).

For example, if some packages depend on a PSR3 Logger, a rewrite will be needed (because we would propose an implementation uncompatible with that interface and it's not "acceptable").

Regards,

Florian

Andrew Eddie

unread,
Mar 2, 2013, 3:43:12 PM3/2/13
to JPlatform
On 3 March 2013 06:35, Florian Voutzinos <voutzino...@gmail.com> wrote:
I think we should drop it from the framework, otherwise it can be confusing (ie. people don't know what to use).

For example, if some packages depend on a PSR3 Logger, a rewrite will be needed (because we would propose an implementation uncompatible with that interface and it's not "acceptable").

Ok, but we would need to do that in V1.0 then because Database is affected. Shall I move this task into V1 scope?:


Regards,
Andrew Eddie

Florian Voutzinos

unread,
Mar 2, 2013, 3:47:34 PM3/2/13
to joomla-de...@googlegroups.com
Yes or 2.0 at the same time the database package is modified.

So I would add .."and then delete the log package".

Andrew Eddie

unread,
Mar 6, 2013, 3:53:52 PM3/6/13
to JPlatform
On 7 March 2013 02:54, Eirik Sletteberg <eiriksl...@gmail.com> wrote:
What about this solution?
(1) Rewrite JLog as a compatibility layer on top of Monolog. Let it stay API-compatible with today's version, but with no further development. Deprecate it.

I think that's double handling myself.
 
(2) Rewrite the CMS piece by piece, to move from this wrapper to using Monolog directly.

The CMS will just use the current JLog for as long as it sees fit. JLog is the least of the CMS's worries in terms of the code it needs to upgrade.
 
(3) Wait for extension developers to do the same.
(4) And then, in the end, remove the compatibility layer.
Joomla/joomla-framework-log will be a composer package with a dependency on Monolog. Monolog will then be a transitive dependency of the CMS.

We don't really need to do that because the CMS will not be using the FW from day one. The earliest it could implement any new/replacement package is 3.2. I think if the CMS wanted to do as you suggest and refactor JLog to be PSR-3 compliant, that's something they could do as a special case. But I don't feel, moving forward, that's something we have to do the FW.

Does that make sense?

Regards,
Andrew Eddie
Reply all
Reply to author
Forward
0 new messages