maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Walton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MNG-5835) Maven-Plugin's getLog() ignores -Dorg.slf4j.simpleLogger.defaultLogLevel=warn
Date Mon, 08 Jun 2015 07:49:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-5835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14576707#comment-14576707
] 

Joseph Walton commented on MNG-5835:
------------------------------------

bq. However, I just created a slightly changed hello-maven-plugin

Don't do that ;-)

If you call {{getLog()}} in your constructor then you'll [get an instance of {{SystemStreamLog}}|https://github.com/apache/maven/blob/40d5087b6b134842e2b61a567dbb4bfbcfab7ae6/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java#L177]
that unconditionally logs to {{System.out}}. Your mojo will be wired with an SLF4J-backed
logger *after* construction.

Call {{getLog()}} during the {{execute()}} method, and don't cache the value.

If any of this behaviour seems like it could be improved, consider being specific about your
use case and your expectations. Otherwise these sound like cases where the documentation should
be clearer, rather than the behaviour changed.


> Maven-Plugin's getLog() ignores -Dorg.slf4j.simpleLogger.defaultLogLevel=warn
> -----------------------------------------------------------------------------
>
>                 Key: MNG-5835
>                 URL: https://issues.apache.org/jira/browse/MNG-5835
>             Project: Maven
>          Issue Type: Bug
>          Components: Logging
>    Affects Versions: 3.2.3, 3.3.3
>            Reporter: S L
>         Attachments: hello-maven-plugin.zip, hello-maven-plugin2.zip
>
>
> Hi,
> since Maven should supports slf4j-Logging combined with the SLF4J Simple implementation
from Maven 3.1.0 onward (http://maven.apache.org/maven-logging.html).
> I'm kind of wondering why the default getLog() called from a Plugin ignores the Environment-Variable
``-Dorg.slf4j.simpleLogger.defaultLogLevel=warn``
> I'm currently using:
> Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
> Maven home: /usr/share/maven-3.2.3
> Java version: 1.7.0_80, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-7-oracle/jre
> Default locale: de_DE, platform encoding: UTF-8
> OS name: "linux", version: "3.16.0-33-generic", arch: "amd64", family: "unix"
> Tested with different Maven-Versions and different maven-plugin-api Versions, still no
success.
> Any help is highly appreciated.
> Thanks,
> PS: Hopefully I can attach my Example-Project which can be executed by using:
> mvn clean install && mvn clean package -Pdemo -Dorg.slf4j.simpleLogger.defaultLogLevel=warn



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message