You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Benson Margulies <bi...@gmail.com> on 2012/11/20 02:29:45 UTC

Logging in plugins right now

Do we have, right now, either:

1) A way of mapping java-commons-logging to the mojo log API, or

2) A way of mapping slf4j to the mojo log?

?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Logging in plugins right now

Posted by Dennis Lundberg <de...@apache.org>.
On 2012-11-20 04:13, Jason van Zyl wrote:
> 
> On Nov 19, 2012, at 8:44 PM, Benson Margulies <bi...@gmail.com> wrote:
> 
>> On Mon, Nov 19, 2012 at 8:34 PM, Jason van Zyl <ja...@tesla.io> wrote:
>>>
>>> On Nov 19, 2012, at 8:29 PM, Benson Margulies <bi...@gmail.com> wrote:
>>>
>>>> Do we have, right now, either:
>>>>
>>>> 1) A way of mapping java-commons-logging to the mojo log API, or
>>>>
>>>
>>> Do you mean commons-logging, JUL, or both? There are ways to adapt both to SLF4J.
>>
>> The former, but it doesn't matter.
>>
>> If I add a dependency, in a plugin, that uses commons-logging, I want
>> to map the log messages from that dependency to the mojo log, so that
>> they look right even with Maven 3.0.x.
> 
> If memory serves, commons-logging will look for Log4j, then JUL, and if neither of those are present then a NoOp implementation is selected. So in our case, most people being 1.4+, the JDK implementation will be chosen and the default for JUL is to output to the console so they will come out with the rest of the output but the formatting will be slightly different. Probably nothing horrible.

It's very easy for an application to explicitly use the simplelog
implementation in commons-logging. The formatting for it can be tweaked
to look like Maven's normal console logging. No added dependency is
needed, just a couple of properties files. I can help to set this up.

>> I appreciate that as of 3.1 I
>> can just use the usual jcl-over-slf4j (or jul or whatever) and the
>> messages will end up in the right-ish place, though not associated
>> with the mojo. I was hoping for
>>
> 
> No mojo specific logging is present right now. It's just all using SLF4J but no real hierarchy, or markers have been established. So for 3.1.0 and before the output is going to look more or less the same.
> 
>>    plugin code calls (e.g.) CXF code calls SLF4J calls
>> something-we-lack calls mojo log calls SLF4J calls SLF4J-simple (in
>> 3.1)
>>
>> and
>>
>>
>>  plugin code calls (e.g.) CXF code calls SLF4J calls
>> something-we-lack calls mojo log calls whatever we have today (in 2.x
>> or 3.0.x)
>>
> 
> In both cases now it's just all going to come out on the console.
> 
>>
>>
>>>
>>>> 2) A way of mapping slf4j to the mojo log?
>>>>
>>>
>>> Mojo.getLog() feeds into SLF4J with the code on trunk.
>>>
>>>> ?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>
>>> Thanks,
>>>
>>> Jason
>>>
>>> ----------------------------------------------------------
>>> Jason van Zyl
>>> Founder & CTO, Sonatype
>>> Founder,  Apache Maven
>>> http://twitter.com/jvanzyl
>>> ---------------------------------------------------------
>>>
>>> In short, man creates for himself a new religion of a rational
>>> and technical order to justify his work and to be justified in it.
>>>
>>>  -- Jacques Ellul, The Technological Society
>>>
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder & CTO, Sonatype
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
> 
> Three people can keep a secret provided two of them are dead.
> 
>  -- Benjamin Franklin
> 
> 
> 
> 
> 
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Logging in plugins right now

Posted by Jason van Zyl <ja...@tesla.io>.
On Nov 19, 2012, at 8:44 PM, Benson Margulies <bi...@gmail.com> wrote:

> On Mon, Nov 19, 2012 at 8:34 PM, Jason van Zyl <ja...@tesla.io> wrote:
>> 
>> On Nov 19, 2012, at 8:29 PM, Benson Margulies <bi...@gmail.com> wrote:
>> 
>>> Do we have, right now, either:
>>> 
>>> 1) A way of mapping java-commons-logging to the mojo log API, or
>>> 
>> 
>> Do you mean commons-logging, JUL, or both? There are ways to adapt both to SLF4J.
> 
> The former, but it doesn't matter.
> 
> If I add a dependency, in a plugin, that uses commons-logging, I want
> to map the log messages from that dependency to the mojo log, so that
> they look right even with Maven 3.0.x.

If memory serves, commons-logging will look for Log4j, then JUL, and if neither of those are present then a NoOp implementation is selected. So in our case, most people being 1.4+, the JDK implementation will be chosen and the default for JUL is to output to the console so they will come out with the rest of the output but the formatting will be slightly different. Probably nothing horrible.

> I appreciate that as of 3.1 I
> can just use the usual jcl-over-slf4j (or jul or whatever) and the
> messages will end up in the right-ish place, though not associated
> with the mojo. I was hoping for
> 

No mojo specific logging is present right now. It's just all using SLF4J but no real hierarchy, or markers have been established. So for 3.1.0 and before the output is going to look more or less the same.

>    plugin code calls (e.g.) CXF code calls SLF4J calls
> something-we-lack calls mojo log calls SLF4J calls SLF4J-simple (in
> 3.1)
> 
> and
> 
> 
>  plugin code calls (e.g.) CXF code calls SLF4J calls
> something-we-lack calls mojo log calls whatever we have today (in 2.x
> or 3.0.x)
> 

In both cases now it's just all going to come out on the console.

> 
> 
>> 
>>> 2) A way of mapping slf4j to the mojo log?
>>> 
>> 
>> Mojo.getLog() feeds into SLF4J with the code on trunk.
>> 
>>> ?
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>> 
>> 
>> Thanks,
>> 
>> Jason
>> 
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder & CTO, Sonatype
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> ---------------------------------------------------------
>> 
>> In short, man creates for himself a new religion of a rational
>> and technical order to justify his work and to be justified in it.
>> 
>>  -- Jacques Ellul, The Technological Society
>> 
>> 
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder & CTO, Sonatype
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

Three people can keep a secret provided two of them are dead.

 -- Benjamin Franklin






Re: Logging in plugins right now

Posted by Benson Margulies <bi...@gmail.com>.
On Mon, Nov 19, 2012 at 8:34 PM, Jason van Zyl <ja...@tesla.io> wrote:
>
> On Nov 19, 2012, at 8:29 PM, Benson Margulies <bi...@gmail.com> wrote:
>
>> Do we have, right now, either:
>>
>> 1) A way of mapping java-commons-logging to the mojo log API, or
>>
>
> Do you mean commons-logging, JUL, or both? There are ways to adapt both to SLF4J.

The former, but it doesn't matter.

If I add a dependency, in a plugin, that uses commons-logging, I want
to map the log messages from that dependency to the mojo log, so that
they look right even with Maven 3.0.x. I appreciate that as of 3.1 I
can just use the usual jcl-over-slf4j (or jul or whatever) and the
messages will end up in the right-ish place, though not associated
with the mojo. I was hoping for

    plugin code calls (e.g.) CXF code calls SLF4J calls
something-we-lack calls mojo log calls SLF4J calls SLF4J-simple (in
3.1)

and


  plugin code calls (e.g.) CXF code calls SLF4J calls
something-we-lack calls mojo log calls whatever we have today (in 2.x
or 3.0.x)



>
>> 2) A way of mapping slf4j to the mojo log?
>>
>
> Mojo.getLog() feeds into SLF4J with the code on trunk.
>
>> ?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder & CTO, Sonatype
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
>
> In short, man creates for himself a new religion of a rational
> and technical order to justify his work and to be justified in it.
>
>   -- Jacques Ellul, The Technological Society
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Logging in plugins right now

Posted by Jason van Zyl <ja...@tesla.io>.
On Nov 19, 2012, at 8:29 PM, Benson Margulies <bi...@gmail.com> wrote:

> Do we have, right now, either:
> 
> 1) A way of mapping java-commons-logging to the mojo log API, or
> 

Do you mean commons-logging, JUL, or both? There are ways to adapt both to SLF4J.

> 2) A way of mapping slf4j to the mojo log?
> 

Mojo.getLog() feeds into SLF4J with the code on trunk.

> ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder & CTO, Sonatype
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

  -- Jacques Ellul, The Technological Society