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

S L commented on MNG-5835:
--------------------------

Hi [~j...@kafsemo.org] thanks for clarifying the difference behind the scenes. 
This really helps and I highly appreciate the time you take to look into my 
problem :-) 
I wasn't aware that you get some sort of different logger if you call the 
getLog before the construction.

In my option not caching the logger value somewhere can under some condition 
violate the OOP principle of encapsulation.
I personally prefer some sort of LoggerBridge so in case something with the 
logging change I just need to adjust the Bridge and not my whole code [maybe 
this is old-fashioned but I suffered once and don't want to repeat that ;)].
I guess this may be some sort of personal problem and to be honest I don't want 
to have changed anything in the behavior you outlined in your previous post.

Nevertheless, and regrading the workaround, I think that the original problem 
needs to be addressed. As you outlined this either needs to be addressed in the 
docs or in the code. From my personal point of view I slightly prefer that 
issue to be fixed in the code.
This is due to the fact that the SimpleLogger checks whether there are 
properties present for slf4j logger configuration
{quote}
http://grepcode.com/file/repo1.maven.org/maven2/org.slf4j/slf4j-simple/1.7.12/org/slf4j/impl/SimpleLogger.java/#SimpleLogger.init%28%29

    static void  init() {
        String defaultLogLevelString = getStringProperty(DEFAULT_LOG_LEVEL_KEY, 
null);
        if (defaultLogLevelString != null)
            DEFAULT_LOG_LEVEL = stringToLevel(defaultLogLevelString);

whereas getStringProperty should extracts the Property from the System 
Properties:
http://grepcode.com/file/repo1.maven.org/maven2/org.slf4j/slf4j-simple/1.7.12/org/slf4j/impl/SimpleLogger.java/#SimpleLogger.getStringProperty%28java.lang.String%29
    ....
    System.getProperty(name);
{quote}

> 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)

Reply via email to