You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sander Verhagen <sa...@sanderverhagen.net> on 2015/04/16 08:19:59 UTC

Logging for dependencies of Maven plugin

Hi group,


I already asked<http://stackoverflow.com/questions/29619125/logging-for-dependencies-of-maven-plugin> this on Stack Overflow, but I think it's a somewhat specialized question, so I wanted to ask here as well. I would like to influence logging of dependencies of a plugin that I'm contributing to, so that when Maven is ran in debug (-X, --debug) I can log some sensible debug information in the context of my plugin, without being flooded with debug logging from my plugin's dependencies.

This is the situation:

*         Building a plugin

*         The plugin depends on org.apache.httpcomponents:httpclient:4.3.6 and uses HttpClientBuilder to build a CloseableHttpClient

*         When Maven runs in debug (-X, --debug) also HttpClient kicks into debug mode

*         While in debug mode, HttpClient logs way, way more than I want

How can I configure my plugin so that a certain logger is not set to DEBUG, even though Maven is in debug (-X, --debug)?

I have tried various strategies of doing this programmatically, or providing the logging configurations for a few of the common frameworks that I suspect are on my classpath (SLF4J, Commons Logging, Log4j), but all to no avail.

Your help much appreciated.


Sander Verhagen
[  sander@sanderverhagen.net<ma...@sanderverhagen.net>  ]


Re: Logging for dependencies of Maven plugin

Posted by Robert Scholte <rf...@apache.org>.
Hi Sander,

the next line of the documentation should interest you:
"The following system properties are supported to configure the behavior  
of this logger:"
So you can set them programmatically as well or by cmdline, no need to use  
the simplelogger.properties.

If I understand you correctly, you want to specify the loglevel for third  
party jars. I think that's not up to the plugin developer, but up to the  
plugin user.

I've been thinking about a solution to specify the logging level for a  
specific plugin execution, because often you're only interested in debug  
logging of a specific plugin and not in the complete Maven execution.
This is a real challenge to solve, especially in a multithreaded  
environment.

thanks,
Robert

Op Fri, 17 Apr 2015 05:56:03 +0200 schreef Sander Verhagen
<sa...@sanderverhagen.net>:

> Hi all,
>
>
> Thank you, Robert. I understand that you suggest changing a  
> configuration file that is part of the local Maven installation. While  
> that strategy would (possibly) suffice for myself, when debugging this  
> plugin, I would appreciate contributing back a solution for all users of  
> this plugin that worked without changing their local Maven installation.  
> Are there any expectations with the current implementation of Maven,  
> that plugins would be able to extend/override the definitions of  
> $MAVEN_HOME/conf/logging/simplelogger.properties? I had seen your link  
> [1] before and it mentions "a class loader resource named  
> "simplelogger.properties"", but I'm unfamiliar in how that translates to  
> class loading scopes of plugins (although I'd suspect that it would  
> override the entire simplelogger.properties at best, if that already,  
> which would not be extremely helpful).
>
> I'd say that HttpClient is using commons-logging.
>
> Sander.
>
>
> Sander Verhagen
> [  sander@sanderverhagen.net  ]
>
> NOTICE: my e-mail address has changed. You may still e-mail me at  
> Verhagen@Sander.com but you will see me using Sander@SanderVerhagen.net  
> from now on. Feel free to update your address book.
>
>
>> -----Original Message-----
>> From: Robert Scholte [mailto:rfscholte@apache.org]
>> Sent: Thursday, April 16, 2015 10:08
>> To: Maven Users List
>> Subject: Re: Logging for dependencies of Maven plugin
>>
>> Hi,
>>
>> This might be possible with Maven-3.1.1+ by changing the apache-maven-
>> 3.x/conf/logging/simplelogger.properties
>> See SimpleLogger[1] for the configuration options.
>> You need to specify a specific logLevel for these packages
>> (org.slf4j.simpleLogger.log.a.b.c) , so it doesn't pick up the  
>> defaultLogLevel (
>> as passed by Maven, e.g. -X will set defaultLogLevel to
>> debug)
>> However, I don't know which logging framework is used by HttpClient. You
>> might need to add a specific SLF4J adapter to the  
>> apache-maven-3.x/lib/ext
>> for that.
>> This is how it should work, but I haven't tried it yet.
>>
>> thanks,
>> Robert
>>
>> [1] http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html
>>
>>
>> Op Thu, 16 Apr 2015 16:54:24 +0200 schreef Endo Alejandro
>> <Al...@grassvalley.com>:
>>
>> > I've wondered this myself for a while as well. Hope you find an answer
>> >
>> > -----Original Message-----
>> > From: Sander Verhagen [mailto:sander@sanderverhagen.net]
>> > Sent: Thursday, April 16, 2015 02:20 AM
>> > To: users@maven.apache.org
>> > Subject: Logging for dependencies of Maven plugin
>> >
>> > Hi group,
>> >
>> >
>> > I already
>> > asked<http://stackoverflow.com/questions/29619125/logging-for-
>> dependen
>> > cies-of-maven-plugin> this on Stack Overflow, but I think it's a
>> > somewhat specialized question, so I wanted to ask here as well. I
>> > would like to influence logging of dependencies of a plugin that I'm
>> > contributing to, so that when Maven is ran in debug (-X, --debug) I
>> > can log some sensible debug information in the context of my plugin,
>> > without being flooded with debug logging from my plugin's
>> > dependencies.
>> >
>> > This is the situation:
>> >
>> > *         Building a plugin
>> >
>> > *         The plugin depends on
>> > org.apache.httpcomponents:httpclient:4.3.6 and uses HttpClientBuilder
>> > to build a CloseableHttpClient
>> >
>> > *         When Maven runs in debug (-X, --debug) also HttpClient kicks
>> > into debug mode
>> >
>> > *         While in debug mode, HttpClient logs way, way more than I  
>> want
>> >
>> > How can I configure my plugin so that a certain logger is not set to
>> > DEBUG, even though Maven is in debug (-X, --debug)?
>> >
>> > I have tried various strategies of doing this programmatically, or
>> > providing the logging configurations for a few of the common
>> > frameworks that I suspect are on my classpath (SLF4J, Commons Logging,
>> > Log4j), but all to no avail.
>> >
>> > Your help much appreciated.
>> >
>> >
>> > Sander Verhagen
>> > [  sander@sanderverhagen.net<ma...@sanderverhagen.net>  ]
>> >
>> >
>> > DISCLAIMER:
>> > Privileged and/or Confidential information may be contained in this
>> > message. If you are not the addressee of this message, you may not
>> > copy, use or deliver this message to anyone. In such event, you should
>> > destroy the message and kindly notify the sender by reply e-mail. It
>> > is understood that opinions or conclusions that do not relate to the
>> > official business of the company are neither given nor endorsed by the
>> > company.
>> > Thank You.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

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


RE: Logging for dependencies of Maven plugin

Posted by Sander Verhagen <sa...@sanderverhagen.net>.
Hi all,


Thank you, Robert. I understand that you suggest changing a configuration file that is part of the local Maven installation. While that strategy would (possibly) suffice for myself, when debugging this plugin, I would appreciate contributing back a solution for all users of this plugin that worked without changing their local Maven installation. Are there any expectations with the current implementation of Maven, that plugins would be able to extend/override the definitions of $MAVEN_HOME/conf/logging/simplelogger.properties? I had seen your link [1] before and it mentions "a class loader resource named "simplelogger.properties"", but I'm unfamiliar in how that translates to class loading scopes of plugins (although I'd suspect that it would override the entire simplelogger.properties at best, if that already, which would not be extremely helpful).

I'd say that HttpClient is using commons-logging.

Sander.


Sander Verhagen
[  sander@sanderverhagen.net  ]

NOTICE: my e-mail address has changed. You may still e-mail me at Verhagen@Sander.com but you will see me using Sander@SanderVerhagen.net from now on. Feel free to update your address book.


> -----Original Message-----
> From: Robert Scholte [mailto:rfscholte@apache.org]
> Sent: Thursday, April 16, 2015 10:08
> To: Maven Users List
> Subject: Re: Logging for dependencies of Maven plugin
> 
> Hi,
> 
> This might be possible with Maven-3.1.1+ by changing the apache-maven-
> 3.x/conf/logging/simplelogger.properties
> See SimpleLogger[1] for the configuration options.
> You need to specify a specific logLevel for these packages
> (org.slf4j.simpleLogger.log.a.b.c) , so it doesn't pick up the defaultLogLevel (
> as passed by Maven, e.g. -X will set defaultLogLevel to
> debug)
> However, I don't know which logging framework is used by HttpClient. You
> might need to add a specific SLF4J adapter to the apache-maven-3.x/lib/ext
> for that.
> This is how it should work, but I haven't tried it yet.
> 
> thanks,
> Robert
> 
> [1] http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html
> 
> 
> Op Thu, 16 Apr 2015 16:54:24 +0200 schreef Endo Alejandro
> <Al...@grassvalley.com>:
> 
> > I've wondered this myself for a while as well. Hope you find an answer
> >
> > -----Original Message-----
> > From: Sander Verhagen [mailto:sander@sanderverhagen.net]
> > Sent: Thursday, April 16, 2015 02:20 AM
> > To: users@maven.apache.org
> > Subject: Logging for dependencies of Maven plugin
> >
> > Hi group,
> >
> >
> > I already
> > asked<http://stackoverflow.com/questions/29619125/logging-for-
> dependen
> > cies-of-maven-plugin> this on Stack Overflow, but I think it's a
> > somewhat specialized question, so I wanted to ask here as well. I
> > would like to influence logging of dependencies of a plugin that I'm
> > contributing to, so that when Maven is ran in debug (-X, --debug) I
> > can log some sensible debug information in the context of my plugin,
> > without being flooded with debug logging from my plugin's
> > dependencies.
> >
> > This is the situation:
> >
> > *         Building a plugin
> >
> > *         The plugin depends on
> > org.apache.httpcomponents:httpclient:4.3.6 and uses HttpClientBuilder
> > to build a CloseableHttpClient
> >
> > *         When Maven runs in debug (-X, --debug) also HttpClient kicks
> > into debug mode
> >
> > *         While in debug mode, HttpClient logs way, way more than I want
> >
> > How can I configure my plugin so that a certain logger is not set to
> > DEBUG, even though Maven is in debug (-X, --debug)?
> >
> > I have tried various strategies of doing this programmatically, or
> > providing the logging configurations for a few of the common
> > frameworks that I suspect are on my classpath (SLF4J, Commons Logging,
> > Log4j), but all to no avail.
> >
> > Your help much appreciated.
> >
> >
> > Sander Verhagen
> > [  sander@sanderverhagen.net<ma...@sanderverhagen.net>  ]
> >
> >
> > DISCLAIMER:
> > Privileged and/or Confidential information may be contained in this
> > message. If you are not the addressee of this message, you may not
> > copy, use or deliver this message to anyone. In such event, you should
> > destroy the message and kindly notify the sender by reply e-mail. It
> > is understood that opinions or conclusions that do not relate to the
> > official business of the company are neither given nor endorsed by the
> > company.
> > Thank You.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


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


Re: Logging for dependencies of Maven plugin

Posted by Robert Scholte <rf...@apache.org>.
Hi,

This might be possible with Maven-3.1.1+ by changing the  
apache-maven-3.x/conf/logging/simplelogger.properties
See SimpleLogger[1] for the configuration options.
You need to specify a specific logLevel for these packages  
(org.slf4j.simpleLogger.log.a.b.c) , so it doesn't pick up the  
defaultLogLevel ( as passed by Maven, e.g. -X will set defaultLogLevel to  
debug)
However, I don't know which logging framework is used by HttpClient. You  
might need to add a specific SLF4J adapter to the apache-maven-3.x/lib/ext  
for that.
This is how it should work, but I haven't tried it yet.

thanks,
Robert

[1] http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html


Op Thu, 16 Apr 2015 16:54:24 +0200 schreef Endo Alejandro  
<Al...@grassvalley.com>:

> I've wondered this myself for a while as well. Hope you find an answer
>
> -----Original Message-----
> From: Sander Verhagen [mailto:sander@sanderverhagen.net]
> Sent: Thursday, April 16, 2015 02:20 AM
> To: users@maven.apache.org
> Subject: Logging for dependencies of Maven plugin
>
> Hi group,
>
>
> I already  
> asked<http://stackoverflow.com/questions/29619125/logging-for-dependencies-of-maven-plugin>  
> this on Stack Overflow, but I think it's a somewhat specialized  
> question, so I wanted to ask here as well. I would like to influence  
> logging of dependencies of a plugin that I'm contributing to, so that  
> when Maven is ran in debug (-X, --debug) I can log some sensible debug  
> information in the context of my plugin, without being flooded with  
> debug logging from my plugin's dependencies.
>
> This is the situation:
>
> *         Building a plugin
>
> *         The plugin depends on  
> org.apache.httpcomponents:httpclient:4.3.6 and uses HttpClientBuilder to  
> build a CloseableHttpClient
>
> *         When Maven runs in debug (-X, --debug) also HttpClient kicks  
> into debug mode
>
> *         While in debug mode, HttpClient logs way, way more than I want
>
> How can I configure my plugin so that a certain logger is not set to  
> DEBUG, even though Maven is in debug (-X, --debug)?
>
> I have tried various strategies of doing this programmatically, or  
> providing the logging configurations for a few of the common frameworks  
> that I suspect are on my classpath (SLF4J, Commons Logging, Log4j), but  
> all to no avail.
>
> Your help much appreciated.
>
>
> Sander Verhagen
> [  sander@sanderverhagen.net<ma...@sanderverhagen.net>  ]
>
>
> DISCLAIMER:
> Privileged and/or Confidential information may be contained in this
> message. If you are not the addressee of this message, you may not
> copy, use or deliver this message to anyone. In such event, you
> should destroy the message and kindly notify the sender by reply
> e-mail. It is understood that opinions or conclusions that do not
> relate to the official business of the company are neither given
> nor endorsed by the company.
> Thank You.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

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


RE: Logging for dependencies of Maven plugin

Posted by Endo Alejandro <Al...@grassvalley.com>.
I've wondered this myself for a while as well. Hope you find an answer

-----Original Message-----
From: Sander Verhagen [mailto:sander@sanderverhagen.net] 
Sent: Thursday, April 16, 2015 02:20 AM
To: users@maven.apache.org
Subject: Logging for dependencies of Maven plugin

Hi group,


I already asked<http://stackoverflow.com/questions/29619125/logging-for-dependencies-of-maven-plugin> this on Stack Overflow, but I think it's a somewhat specialized question, so I wanted to ask here as well. I would like to influence logging of dependencies of a plugin that I'm contributing to, so that when Maven is ran in debug (-X, --debug) I can log some sensible debug information in the context of my plugin, without being flooded with debug logging from my plugin's dependencies.

This is the situation:

*         Building a plugin

*         The plugin depends on org.apache.httpcomponents:httpclient:4.3.6 and uses HttpClientBuilder to build a CloseableHttpClient

*         When Maven runs in debug (-X, --debug) also HttpClient kicks into debug mode

*         While in debug mode, HttpClient logs way, way more than I want

How can I configure my plugin so that a certain logger is not set to DEBUG, even though Maven is in debug (-X, --debug)?

I have tried various strategies of doing this programmatically, or providing the logging configurations for a few of the common frameworks that I suspect are on my classpath (SLF4J, Commons Logging, Log4j), but all to no avail.

Your help much appreciated.


Sander Verhagen
[  sander@sanderverhagen.net<ma...@sanderverhagen.net>  ]


DISCLAIMER:
Privileged and/or Confidential information may be contained in this
message. If you are not the addressee of this message, you may not
copy, use or deliver this message to anyone. In such event, you
should destroy the message and kindly notify the sender by reply
e-mail. It is understood that opinions or conclusions that do not
relate to the official business of the company are neither given
nor endorsed by the company.
Thank You.

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