Log4j2 supports the "OFF" level which is higher than "FATAL" effectively
disabling logging. I'm not sure if there's an equivalent in v1 or Logback.

On 30 March 2017 at 14:53, 'Achim Nierbeck' via OPS4J <
[email protected]> wrote:

> Well if you only install the api bundle you don't have any logging as that
> is only the API bundle.
> The implementation and the actual logging is done from the service bundle.
>
> regarding NONE beeing a bug, I doubt that this is a bug.
> Pax Logging just leverages different logging apis to one provider (log4j2,
> with the latest one)
> afaik none of the logging frameworks I'm aware of right now does have a
> log level NONE (might be wrong on that, but never seen it or used it)
> Usually if you don't want to log a certain class or certain packages
> exclude those.
>
> take a look at the log4j project for details [1]
>
> regards, Achim
>
> [1] - https://logging.apache.org/log4j/2.x/manual/
> configuration.html#Loggers
>
>
> 2017-03-30 11:22 GMT+02:00 Pavel <[email protected]>:
>
>> 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]>:
>>>
>>>> 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]
>>>>
>>>> ---
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> 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.
>>
>
>
>
> --
>
> 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.
>



-- 
Matt Sicker <[email protected]>

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