However, I have noticed that when I add to my project only pax-logging-api 
such problem doesn't appear.

However, when I add also pax-logging-service such problem appears.

After reading the source code it seems that it is bug in 
org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl in method 
convertLevel.
There is no condition when levelName=NONE.

See this code

        if( m_bundleContext == null )
        {
            levelName = System.getProperty( DEFAULT_SERVICE_LOG_LEVEL, 
"DEBUG" ).trim();
        }
        else
        {
            levelName = m_bundleContext.getProperty( 
DEFAULT_SERVICE_LOG_LEVEL );
            if( levelName == null )
            {
                levelName = "DEBUG";
            }
            else
            {
                levelName = levelName.trim();
            }
        }
        m_logLevel = convertLevel( levelName );
 .....

    private static int convertLevel( String levelName )
    {
        if( "DEBUG".equals( levelName ) )
        {
            return LOG_DEBUG;
        }
        else if( "INFO".equals( levelName ) )
        {
            return LOG_INFO;
        }
        else if( "ERROR".equals( levelName ) )
        {
            return LOG_ERROR;
        }
        else if( "WARN".equals( levelName ) )
        {
            return LOG_WARNING;
        }
        else
        {
            return LOG_DEBUG;
        }
    }


четверг, 30 марта 2017 г., 11:42:33 UTC+3 пользователь Achim Nierbeck 
написал:
>
> Hi Pavel, 
>
> I doubt the log providers used by Pax-Logging support this concept of 
> "disabling" the logging this way. 
> Usually you just don't define an appender, if no appender no output :) 
>
> Regards, Achim 
>
> 2017-03-29 16:24 GMT+02:00 Pavel <[email protected] <javascript:>>:
>
>> Hi all.
>>
>> I have the following problem. When I set 
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=ERROR - I get error 
>> level
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=DEBUG - I get debug 
>> level
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=INFO - I get info 
>> level
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN - I get warn 
>> level
>>
>> However, when I set
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=NONE - I get debug 
>> level
>>     -Dorg.ops4j.pax.logging.DefaultServiceLog.level=OFF - I get debug 
>> level.
>>
>> I tried with pax-logging-ap 1.8.5 and 1.9.1. result is the same.
>>
>> Could anyone say how logging from API can be completely turned off? 
>>
>> Best regards, Pavel
>>
>> -- 
>> -- 
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected] <javascript:>
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & 
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master 
>
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to