You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by syedbahm <sy...@cisco.com> on 2014/10/22 19:50:30 UTC

pax-logback-service not working in karaf distribution

Hi,
After attempting to have a flume log4j appender but couldn't make it work as
discussed as part of this thread..
http://karaf.922171.n3.nabble.com/Enabling-Flume-log4j-appender-logging-in-Karaf-td4036033.html#a4036041
and not knowing how to further debug the same.. thought of trying the
pax-logback-service followed by using the logback-flume appender and I have
done the configuration as documented for pax-logback-service -- still I
don't see the karaf.log populated..  The last thing I see in karaf.log is as
shown below and nothing else.. Please provide any knobs that I can turn on
to debug this in Karaf. I have included the configuration I did below.. 

---

Oct 22, 2014 10:32:46 AM org.apache.karaf.main.Main$KarafLockCallback
lockAquired
INFO: Lock acquired. Setting startlevel to 100


----

1. When I check pax-logback service status it shows  as Active as shown
below.. 

bundle:list |grep Logback
 8 | Active   |   8 | 1.7.2                                     | OPS4J Pax
Logging - Logback Service   

2. My org.ops4.pax.logging.cfg looks like this 

...
...
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
################################################################################

org.ops4j.pax.logging.logback.config.file=${karaf.base}/etc/logback.xml


3. My logback.xml looks like this .. 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
    </encoder>
  </appender>

  <appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
   
<file>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.log</file>
    <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      
     
<fileNamePattern>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
      <timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        
        <maxFileSize>100MB</maxFileSize>
      </timeBasedFileNamingAndTriggeringPolicy>
      
      <maxHistory>30</maxHistory>
    </rollingPolicy>
    <append>true</append>
    
    <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
      <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
        <jsonFormatter
class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
          
          <prettyPrint>true</prettyPrint>
        </jsonFormatter>
        <context>api</context>
        <timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampFormat>
       <timestampFormatTimezoneId>UTC</timestampFormatTimezoneId>
        <appendLineSeparator>true</appendLineSeparator>
      </layout>
      
    </encoder>
  </appender>
  <root level="DEBUG">
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="FILE"/>
  </root>

4. my etc/startup.properties looks like this... 

mvn\:org.codehaus.janino/com.springsource.org.codehaus.commons.compiler/2.6.1
= 8
mvn\:org.ops4j.pax.logging/pax-logging-logback/1.7.2 = 8
mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8












--
View this message in context: http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: pax-logback-service not working in karaf distribution

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

ok, ah it's because of the flume appender.
Maybe I've some cycles to take a look at it later.

regards, Achim

2014-11-13 8:58 GMT+01:00 syedbahm <sy...@cisco.com>:

>  Sure.
>
> The whole thread had started based on an attempt done to use log4j flume
> appender with Karaf. Unfortunately it didn't work for me .While I tried the
> logback flume appender it worked without any issues till I hit this issue
> of setting/getting of log-levels. I can switch back to log4j - if I know
> how to debug --  why log4j flume appender (though shows as resolved
> fragment) doesn't work with pax logging service.
>
> thx
>
>
>
>
>
>
> On 11/12/2014 11:50 PM, Achim Nierbeck wrote:
>
> Hi
>
>  I changed it from Bug to new Feature. This is because the log4j backend
> is still the prefered backend for Pax Logging and Karaf. Also due to the
> way it's possible to use the properties to directly manipulate the config
> admin properties.
> So you have a new requirement. The Workaround would be go back to the
> still preferred way of using the log4j backend.
>
>  regards, Achim
>
> 2014-11-13 8:43 GMT+01:00 syedbahm <sy...@cisco.com>:
>
>>  I have openned https://issues.apache.org/jira/browse/KARAF-3358 for the
>> same..
>> Please update it as appropriate -- as Im not sure which component this
>> should be put in -- I have assigned it to Karaf-core for now.
>>
>> The reason I marked it as major is that without it working it would be
>> difficult for us to set the logger levels -- without accessing the
>> logback.xml.
>> If we have a workaround -- that would be helpful
>>
>> thx
>> -Basheeruddin
>>  On 11/12/2014 11:30 PM, Guillaume Nodet wrote:
>>
>> The log:set command unfortunately assumes that the backend is
>> pax-logging-service.
>> This need to be enhanced to work with pax-logging-logback and
>> pax-logging-log4jv2.
>> Could you please raise a JIRA ?
>>
>> 2014-11-13 8:16 GMT+01:00 syedbahm <sy...@cisco.com>:
>>
>>>   Seems the following is happenning:
>>>  Though I have specified the logback.xml usage in
>>> etc/org.ops4j.pax.logging.cfg
>>> by setting
>>> org.ops4j.pax.logging.logback.config.file=<path>/logback.xml
>>>
>>> what I see is that when I set a log level using karaf console
>>> ---
>>> log:set DEBUG
>>> --
>>>
>>> an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
>>> --
>>> log4j.rootLogger = DEBUG
>>> --
>>>
>>> Though my appender is getting picked from logback.xml , the vaious
>>> logger default settings are being looked in etc/org.ops4j.pax.logging.cfg
>>> ? That too log4j ones?
>>>
>>> thx
>>> -syed
>>>
>>>
>>>
>>>
>>>
>>> On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
>>>
>>> This should work, just to verity, can you create different appender and
>>> see whether it works. May be you can write in different file.
>>> Just to me sure, all configurations is proper and its picking up the
>>> logback.xml file configurations.
>>>
>>>   Srikanth Hugar
>>> www.gharki.com
>>>
>>>
>>>
>>> On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <sy...@cisco.com> wrote:
>>>
>>>>  Hi
>>>> Likely you just checked the title and replied. I have
>>>> pax-logback-service working -- in my latest post -- I was asking about  how
>>>> the loggers we define in logback.xml appear in karaf console
>>>> as for me just the root logger shows up i.e. using
>>>>
>>>> log:get ALL
>>>>
>>>> command --- I don't see other loggers that are defined in logback.xml..
>>>> Here is again my query
>>>> ---- start of question -----
>>>>
>>>> One more question
>>>>    I have a bunch of logger defines in logback.xml
>>>>
>>>> e.g.
>>>>
>>>>
>>>>   <logger name="io.netty" level="WARN"/>
>>>>
>>>> I want them to appear when I do log:get ALL in karaf console.  But the
>>>> only
>>>> thing I see in Karaf console is
>>>>
>>>> ---
>>>> Logger | Level
>>>> --------------
>>>> ROOT   | DEBUG
>>>> ---
>>>>
>>>> Where should I specify the other loggers to show up in Karaf console
>>>>  --- end of question ----
>>>>
>>>> thx
>>>> -syed
>>>>
>>>>
>>>>
>>>> On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>>>
>>>>  You could have look the link below, i have done it in karaf and its
>>>> working fine for me.
>>>>
>>>>  I used logback.xml file and added all my logback configurations in
>>>> file.
>>>>
>>>>  http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>>>
>>>>   Srikanth Hugar
>>>> www.gharki.com
>>>>
>>>>
>>>>
>>>> On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <sy...@cisco.com> wrote:
>>>>
>>>>> One more question
>>>>>    I have a bunch of logger defines in logback.xml
>>>>>
>>>>> e.g.
>>>>>
>>>>>
>>>>>   <logger name="io.netty" level="WARN"/>
>>>>>
>>>>> I want them to appear when I do log:get ALL in karaf console.  But the
>>>>> only
>>>>> thing I see in Karaf console is
>>>>>
>>>>> ---
>>>>> Logger | Level
>>>>> --------------
>>>>> ROOT   | DEBUG
>>>>> ---
>>>>>
>>>>> Where should I specify the other loggers to show up in Karaf console
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>>>>  Sent from the Karaf - User mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>  --
>
> 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
>
>
>


-- 

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

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
Sure.

The whole thread had started based on an attempt done to use log4j flume 
appender with Karaf. Unfortunately it didn't work for me .While I tried 
the logback flume appender it worked without any issues till I hit this 
issue of setting/getting of log-levels. I can switch back to log4j - if 
I know how to debug --  why log4j flume appender (though shows as 
resolved fragment) doesn't work with pax logging service.

thx





On 11/12/2014 11:50 PM, Achim Nierbeck wrote:
> Hi
>
> I changed it from Bug to new Feature. This is because the log4j 
> backend is still the prefered backend for Pax Logging and Karaf. Also 
> due to the way it's possible to use the properties to directly 
> manipulate the config admin properties.
> So you have a new requirement. The Workaround would be go back to the 
> still preferred way of using the log4j backend.
>
> regards, Achim
>
> 2014-11-13 8:43 GMT+01:00 syedbahm <syedbahm@cisco.com 
> <ma...@cisco.com>>:
>
>     I have openned https://issues.apache.org/jira/browse/KARAF-3358
>     for the same..
>     Please update it as appropriate -- as Im not sure which component
>     this should be put in -- I have assigned it to Karaf-core for now.
>
>     The reason I marked it as major is that without it working it
>     would be difficult for us to set the logger levels -- without
>     accessing the logback.xml.
>     If we have a workaround -- that would be helpful
>
>     thx
>     -Basheeruddin
>     On 11/12/2014 11:30 PM, Guillaume Nodet wrote:
>>     The log:set command unfortunately assumes that the backend is
>>     pax-logging-service.
>>     This need to be enhanced to work with pax-logging-logback and
>>     pax-logging-log4jv2.
>>     Could you please raise a JIRA ?
>>
>>     2014-11-13 8:16 GMT+01:00 syedbahm <syedbahm@cisco.com
>>     <ma...@cisco.com>>:
>>
>>          Seems the following is happenning:
>>          Though I have specified the logback.xml usage in
>>         etc/org.ops4j.pax.logging.cfg
>>         by setting
>>         org.ops4j.pax.logging.logback.config.file=<path>/logback.xml
>>
>>         what I see is that when I set a log level using karaf console
>>         ---
>>         log:set DEBUG
>>         --
>>
>>         an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
>>         --
>>         log4j.rootLogger = DEBUG
>>         --
>>
>>         Though my appender is getting picked from logback.xml , the
>>         vaious logger default settings are being looked in
>>         etc/org.ops4j.pax.logging.cfg
>>         ? That too log4j ones?
>>
>>         thx
>>         -syed
>>
>>
>>
>>
>>
>>         On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
>>>         This should work, just to verity, can you create different
>>>         appender and see whether it works. May be you can write in
>>>         different file.
>>>         Just to me sure, all configurations is proper and its
>>>         picking up the logback.xml file configurations.
>>>
>>>         Srikanth Hugar
>>>         www.gharki.com <http://www.gharki.com>
>>>
>>>
>>>
>>>         On Thu, Nov 13, 2014 at 10:50 AM, syedbahm
>>>         <syedbahm@cisco.com <ma...@cisco.com>> wrote:
>>>
>>>             Hi
>>>             Likely you just checked the title and replied. I have
>>>             pax-logback-service working -- in my latest post -- I
>>>             was asking about  how the loggers we define in
>>>             logback.xml appear in karaf console
>>>             as for me just the root logger shows up i.e. using
>>>
>>>             log:get ALL
>>>
>>>             command --- I don't see other loggers that are defined
>>>             in logback.xml.. Here is again my query
>>>             ---- start of question -----
>>>
>>>             One more question
>>>                I have a bunch of logger defines in logback.xml
>>>
>>>             e.g.
>>>
>>>
>>>               <logger name="io.netty" level="WARN"/>
>>>
>>>             I want them to appear when I do log:get ALL in karaf
>>>             console.  But the only
>>>             thing I see in Karaf console is
>>>
>>>             ---
>>>             Logger | Level
>>>             --------------
>>>             ROOT   | DEBUG
>>>             ---
>>>
>>>             Where should I specify the other loggers to show up in
>>>             Karaf console
>>>             --- end of question ----
>>>
>>>             thx
>>>             -syed
>>>
>>>
>>>
>>>             On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>>>             You could have look the link below, i have done it in
>>>>             karaf and its working fine for me.
>>>>
>>>>             I used logback.xml file and added all my logback
>>>>             configurations in file.
>>>>
>>>>             http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>>>
>>>>             Srikanth Hugar
>>>>             www.gharki.com <http://www.gharki.com>
>>>>
>>>>
>>>>
>>>>             On Thu, Nov 13, 2014 at 7:20 AM, syedbahm
>>>>             <syedbahm@cisco.com <ma...@cisco.com>> wrote:
>>>>
>>>>                 One more question
>>>>                    I have a bunch of logger defines in logback.xml
>>>>
>>>>                 e.g.
>>>>
>>>>
>>>>                   <logger name="io.netty" level="WARN"/>
>>>>
>>>>                 I want them to appear when I do log:get ALL in
>>>>                 karaf console.  But the only
>>>>                 thing I see in Karaf console is
>>>>
>>>>                 ---
>>>>                 Logger | Level
>>>>                 --------------
>>>>                 ROOT   | DEBUG
>>>>                 ---
>>>>
>>>>                 Where should I specify the other loggers to show up
>>>>                 in Karaf console
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>                 --
>>>>                 View this message in context:
>>>>                 http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>>>                 Sent from the Karaf - User mailing list archive at
>>>>                 Nabble.com.
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
>
> -- 
>
> 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
>


Re: pax-logback-service not working in karaf distribution

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi

I changed it from Bug to new Feature. This is because the log4j backend is
still the prefered backend for Pax Logging and Karaf. Also due to the way
it's possible to use the properties to directly manipulate the config admin
properties.
So you have a new requirement. The Workaround would be go back to the still
preferred way of using the log4j backend.

regards, Achim

2014-11-13 8:43 GMT+01:00 syedbahm <sy...@cisco.com>:

>  I have openned https://issues.apache.org/jira/browse/KARAF-3358 for the
> same..
> Please update it as appropriate -- as Im not sure which component this
> should be put in -- I have assigned it to Karaf-core for now.
>
> The reason I marked it as major is that without it working it would be
> difficult for us to set the logger levels -- without accessing the
> logback.xml.
> If we have a workaround -- that would be helpful
>
> thx
> -Basheeruddin
> On 11/12/2014 11:30 PM, Guillaume Nodet wrote:
>
> The log:set command unfortunately assumes that the backend is
> pax-logging-service.
> This need to be enhanced to work with pax-logging-logback and
> pax-logging-log4jv2.
> Could you please raise a JIRA ?
>
> 2014-11-13 8:16 GMT+01:00 syedbahm <sy...@cisco.com>:
>
>>   Seems the following is happenning:
>>  Though I have specified the logback.xml usage in
>> etc/org.ops4j.pax.logging.cfg
>> by setting
>> org.ops4j.pax.logging.logback.config.file=<path>/logback.xml
>>
>> what I see is that when I set a log level using karaf console
>> ---
>> log:set DEBUG
>> --
>>
>> an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
>> --
>> log4j.rootLogger = DEBUG
>> --
>>
>> Though my appender is getting picked from logback.xml , the vaious logger
>> default settings are being looked in etc/org.ops4j.pax.logging.cfg
>> ? That too log4j ones?
>>
>> thx
>> -syed
>>
>>
>>
>>
>>
>> On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
>>
>> This should work, just to verity, can you create different appender and
>> see whether it works. May be you can write in different file.
>> Just to me sure, all configurations is proper and its picking up the
>> logback.xml file configurations.
>>
>>   Srikanth Hugar
>> www.gharki.com
>>
>>
>>
>> On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <sy...@cisco.com> wrote:
>>
>>>  Hi
>>> Likely you just checked the title and replied. I have
>>> pax-logback-service working -- in my latest post -- I was asking about  how
>>> the loggers we define in logback.xml appear in karaf console
>>> as for me just the root logger shows up i.e. using
>>>
>>> log:get ALL
>>>
>>> command --- I don't see other loggers that are defined in logback.xml..
>>> Here is again my query
>>> ---- start of question -----
>>>
>>> One more question
>>>    I have a bunch of logger defines in logback.xml
>>>
>>> e.g.
>>>
>>>
>>>   <logger name="io.netty" level="WARN"/>
>>>
>>> I want them to appear when I do log:get ALL in karaf console.  But the
>>> only
>>> thing I see in Karaf console is
>>>
>>> ---
>>> Logger | Level
>>> --------------
>>> ROOT   | DEBUG
>>> ---
>>>
>>> Where should I specify the other loggers to show up in Karaf console
>>>  --- end of question ----
>>>
>>> thx
>>> -syed
>>>
>>>
>>>
>>> On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>>
>>>  You could have look the link below, i have done it in karaf and its
>>> working fine for me.
>>>
>>>  I used logback.xml file and added all my logback configurations in
>>> file.
>>>
>>>  http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>>
>>>   Srikanth Hugar
>>> www.gharki.com
>>>
>>>
>>>
>>> On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <sy...@cisco.com> wrote:
>>>
>>>> One more question
>>>>    I have a bunch of logger defines in logback.xml
>>>>
>>>> e.g.
>>>>
>>>>
>>>>   <logger name="io.netty" level="WARN"/>
>>>>
>>>> I want them to appear when I do log:get ALL in karaf console.  But the
>>>> only
>>>> thing I see in Karaf console is
>>>>
>>>> ---
>>>> Logger | Level
>>>> --------------
>>>> ROOT   | DEBUG
>>>> ---
>>>>
>>>> Where should I specify the other loggers to show up in Karaf console
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>>>  Sent from the Karaf - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>>
>
>


-- 

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

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
I have openned https://issues.apache.org/jira/browse/KARAF-3358 for the 
same..
Please update it as appropriate -- as Im not sure which component this 
should be put in -- I have assigned it to Karaf-core for now.

The reason I marked it as major is that without it working it would be 
difficult for us to set the logger levels -- without accessing the 
logback.xml.
If we have a workaround -- that would be helpful

thx
-Basheeruddin
On 11/12/2014 11:30 PM, Guillaume Nodet wrote:
> The log:set command unfortunately assumes that the backend is 
> pax-logging-service.
> This need to be enhanced to work with pax-logging-logback and 
> pax-logging-log4jv2.
> Could you please raise a JIRA ?
>
> 2014-11-13 8:16 GMT+01:00 syedbahm <syedbahm@cisco.com 
> <ma...@cisco.com>>:
>
>      Seems the following is happenning:
>      Though I have specified the logback.xml usage in
>     etc/org.ops4j.pax.logging.cfg
>     by setting
>     org.ops4j.pax.logging.logback.config.file=<path>/logback.xml
>
>     what I see is that when I set a log level using karaf console
>     ---
>     log:set DEBUG
>     --
>
>     an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
>     --
>     log4j.rootLogger = DEBUG
>     --
>
>     Though my appender is getting picked from logback.xml , the vaious
>     logger default settings are being looked in
>     etc/org.ops4j.pax.logging.cfg
>     ? That too log4j ones?
>
>     thx
>     -syed
>
>
>
>
>
>     On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
>>     This should work, just to verity, can you create different
>>     appender and see whether it works. May be you can write in
>>     different file.
>>     Just to me sure, all configurations is proper and its picking up
>>     the logback.xml file configurations.
>>
>>     Srikanth Hugar
>>     www.gharki.com <http://www.gharki.com>
>>
>>
>>
>>     On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <syedbahm@cisco.com
>>     <ma...@cisco.com>> wrote:
>>
>>         Hi
>>         Likely you just checked the title and replied. I have
>>         pax-logback-service working -- in my latest post -- I was
>>         asking about  how the loggers we define in logback.xml appear
>>         in karaf console
>>         as for me just the root logger shows up i.e. using
>>
>>         log:get ALL
>>
>>         command --- I don't see other loggers that are defined in
>>         logback.xml.. Here is again my query
>>         ---- start of question -----
>>
>>         One more question
>>            I have a bunch of logger defines in logback.xml
>>
>>         e.g.
>>
>>
>>           <logger name="io.netty" level="WARN"/>
>>
>>         I want them to appear when I do log:get ALL in karaf
>>         console.  But the only
>>         thing I see in Karaf console is
>>
>>         ---
>>         Logger | Level
>>         --------------
>>         ROOT   | DEBUG
>>         ---
>>
>>         Where should I specify the other loggers to show up in Karaf
>>         console
>>         --- end of question ----
>>
>>         thx
>>         -syed
>>
>>
>>
>>         On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>>         You could have look the link below, i have done it in karaf
>>>         and its working fine for me.
>>>
>>>         I used logback.xml file and added all my logback
>>>         configurations in file.
>>>
>>>         http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>>
>>>         Srikanth Hugar
>>>         www.gharki.com <http://www.gharki.com>
>>>
>>>
>>>
>>>         On Thu, Nov 13, 2014 at 7:20 AM, syedbahm
>>>         <syedbahm@cisco.com <ma...@cisco.com>> wrote:
>>>
>>>             One more question
>>>                I have a bunch of logger defines in logback.xml
>>>
>>>             e.g.
>>>
>>>
>>>               <logger name="io.netty" level="WARN"/>
>>>
>>>             I want them to appear when I do log:get ALL in karaf
>>>             console.  But the only
>>>             thing I see in Karaf console is
>>>
>>>             ---
>>>             Logger | Level
>>>             --------------
>>>             ROOT   | DEBUG
>>>             ---
>>>
>>>             Where should I specify the other loggers to show up in
>>>             Karaf console
>>>
>>>
>>>
>>>
>>>
>>>             --
>>>             View this message in context:
>>>             http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>>             Sent from the Karaf - User mailing list archive at
>>>             Nabble.com.
>>>
>>>
>>
>>
>
>


Re: pax-logback-service not working in karaf distribution

Posted by Guillaume Nodet <gn...@apache.org>.
The log:set command unfortunately assumes that the backend is
pax-logging-service.
This need to be enhanced to work with pax-logging-logback and
pax-logging-log4jv2.
Could you please raise a JIRA ?

2014-11-13 8:16 GMT+01:00 syedbahm <sy...@cisco.com>:

>   Seems the following is happenning:
>  Though I have specified the logback.xml usage in
> etc/org.ops4j.pax.logging.cfg
> by setting
> org.ops4j.pax.logging.logback.config.file=<path>/logback.xml
>
> what I see is that when I set a log level using karaf console
> ---
> log:set DEBUG
> --
>
> an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
> --
> log4j.rootLogger = DEBUG
> --
>
> Though my appender is getting picked from logback.xml , the vaious logger
> default settings are being looked in etc/org.ops4j.pax.logging.cfg
> ? That too log4j ones?
>
> thx
> -syed
>
>
>
>
>
> On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
>
> This should work, just to verity, can you create different appender and
> see whether it works. May be you can write in different file.
> Just to me sure, all configurations is proper and its picking up the
> logback.xml file configurations.
>
>   Srikanth Hugar
> www.gharki.com
>
>
>
> On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <sy...@cisco.com> wrote:
>
>>  Hi
>> Likely you just checked the title and replied. I have pax-logback-service
>> working -- in my latest post -- I was asking about  how the loggers we
>> define in logback.xml appear in karaf console
>> as for me just the root logger shows up i.e. using
>>
>> log:get ALL
>>
>> command --- I don't see other loggers that are defined in logback.xml..
>> Here is again my query
>> ---- start of question -----
>>
>> One more question
>>    I have a bunch of logger defines in logback.xml
>>
>> e.g.
>>
>>
>>   <logger name="io.netty" level="WARN"/>
>>
>> I want them to appear when I do log:get ALL in karaf console.  But the
>> only
>> thing I see in Karaf console is
>>
>> ---
>> Logger | Level
>> --------------
>> ROOT   | DEBUG
>> ---
>>
>> Where should I specify the other loggers to show up in Karaf console
>>  --- end of question ----
>>
>> thx
>> -syed
>>
>>
>>
>> On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>
>>  You could have look the link below, i have done it in karaf and its
>> working fine for me.
>>
>>  I used logback.xml file and added all my logback configurations in file.
>>
>>  http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>
>>   Srikanth Hugar
>> www.gharki.com
>>
>>
>>
>> On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <sy...@cisco.com> wrote:
>>
>>> One more question
>>>    I have a bunch of logger defines in logback.xml
>>>
>>> e.g.
>>>
>>>
>>>   <logger name="io.netty" level="WARN"/>
>>>
>>> I want them to appear when I do log:get ALL in karaf console.  But the
>>> only
>>> thing I see in Karaf console is
>>>
>>> ---
>>> Logger | Level
>>> --------------
>>> ROOT   | DEBUG
>>> ---
>>>
>>> Where should I specify the other loggers to show up in Karaf console
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>>  Sent from the Karaf - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
>

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
  Seems the following is happenning:
  Though I have specified the logback.xml usage in 
etc/org.ops4j.pax.logging.cfg
by setting
org.ops4j.pax.logging.logback.config.file=<path>/logback.xml

what I see is that when I set a log level using karaf console
---
log:set DEBUG
--

an entry gets added to etc/org.ops4j.pax.logging.cfg as follows
--
log4j.rootLogger = DEBUG
--

Though my appender is getting picked from logback.xml , the vaious 
logger default settings are being looked in etc/org.ops4j.pax.logging.cfg
? That too log4j ones?

thx
-syed




On 11/12/2014 10:20 PM, Srikanth Hugar wrote:
> This should work, just to verity, can you create different appender 
> and see whether it works. May be you can write in different file.
> Just to me sure, all configurations is proper and its picking up the 
> logback.xml file configurations.
>
> Srikanth Hugar
> www.gharki.com <http://www.gharki.com>
>
>
>
> On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <syedbahm@cisco.com 
> <ma...@cisco.com>> wrote:
>
>     Hi
>     Likely you just checked the title and replied. I have
>     pax-logback-service working -- in my latest post -- I was asking
>     about  how the loggers we define in logback.xml appear in karaf
>     console
>     as for me just the root logger shows up i.e. using
>
>     log:get ALL
>
>     command --- I don't see other loggers that are defined in
>     logback.xml.. Here is again my query
>     ---- start of question -----
>
>     One more question
>        I have a bunch of logger defines in logback.xml
>
>     e.g.
>
>
>       <logger name="io.netty" level="WARN"/>
>
>     I want them to appear when I do log:get ALL in karaf console.  But
>     the only
>     thing I see in Karaf console is
>
>     ---
>     Logger | Level
>     --------------
>     ROOT   | DEBUG
>     ---
>
>     Where should I specify the other loggers to show up in Karaf console
>     --- end of question ----
>
>     thx
>     -syed
>
>
>
>     On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>>     You could have look the link below, i have done it in karaf and
>>     its working fine for me.
>>
>>     I used logback.xml file and added all my logback configurations
>>     in file.
>>
>>     http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>>
>>     Srikanth Hugar
>>     www.gharki.com <http://www.gharki.com>
>>
>>
>>
>>     On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <syedbahm@cisco.com
>>     <ma...@cisco.com>> wrote:
>>
>>         One more question
>>            I have a bunch of logger defines in logback.xml
>>
>>         e.g.
>>
>>
>>           <logger name="io.netty" level="WARN"/>
>>
>>         I want them to appear when I do log:get ALL in karaf
>>         console.  But the only
>>         thing I see in Karaf console is
>>
>>         ---
>>         Logger | Level
>>         --------------
>>         ROOT   | DEBUG
>>         ---
>>
>>         Where should I specify the other loggers to show up in Karaf
>>         console
>>
>>
>>
>>
>>
>>         --
>>         View this message in context:
>>         http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>         Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>>
>
>


Re: pax-logback-service not working in karaf distribution

Posted by Srikanth Hugar <sr...@gmail.com>.
This should work, just to verity, can you create different appender and see
whether it works. May be you can write in different file.
Just to me sure, all configurations is proper and its picking up the
logback.xml file configurations.

Srikanth Hugar
www.gharki.com



On Thu, Nov 13, 2014 at 10:50 AM, syedbahm <sy...@cisco.com> wrote:

>  Hi
> Likely you just checked the title and replied. I have pax-logback-service
> working -- in my latest post -- I was asking about  how the loggers we
> define in logback.xml appear in karaf console
> as for me just the root logger shows up i.e. using
>
> log:get ALL
>
> command --- I don't see other loggers that are defined in logback.xml..
> Here is again my query
> ---- start of question -----
>
> One more question
>    I have a bunch of logger defines in logback.xml
>
> e.g.
>
>
>   <logger name="io.netty" level="WARN"/>
>
> I want them to appear when I do log:get ALL in karaf console.  But the only
> thing I see in Karaf console is
>
> ---
> Logger | Level
> --------------
> ROOT   | DEBUG
> ---
>
> Where should I specify the other loggers to show up in Karaf console
> --- end of question ----
>
> thx
> -syed
>
>
>
> On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
>
>  You could have look the link below, i have done it in karaf and its
> working fine for me.
>
>  I used logback.xml file and added all my logback configurations in file.
>
>  http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>
>   Srikanth Hugar
> www.gharki.com
>
>
>
> On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <sy...@cisco.com> wrote:
>
>> One more question
>>    I have a bunch of logger defines in logback.xml
>>
>> e.g.
>>
>>
>>   <logger name="io.netty" level="WARN"/>
>>
>> I want them to appear when I do log:get ALL in karaf console.  But the
>> only
>> thing I see in Karaf console is
>>
>> ---
>> Logger | Level
>> --------------
>> ROOT   | DEBUG
>> ---
>>
>> Where should I specify the other loggers to show up in Karaf console
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>>  Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>
>
>

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
Hi
Likely you just checked the title and replied. I have 
pax-logback-service working -- in my latest post -- I was asking about  
how the loggers we define in logback.xml appear in karaf console
as for me just the root logger shows up i.e. using

log:get ALL

command --- I don't see other loggers that are defined in logback.xml.. 
Here is again my query
---- start of question -----

One more question
    I have a bunch of logger defines in logback.xml

e.g.


   <logger name="io.netty" level="WARN"/>

I want them to appear when I do log:get ALL in karaf console.  But the only
thing I see in Karaf console is

---
Logger | Level
--------------
ROOT   | DEBUG
---

Where should I specify the other loggers to show up in Karaf console
--- end of question ----

thx
-syed


On 11/12/2014 07:47 PM, Srikanth Hugar wrote:
> You could have look the link below, i have done it in karaf and its 
> working fine for me.
>
> I used logback.xml file and added all my logback configurations in file.
>
> http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html
>
> Srikanth Hugar
> www.gharki.com <http://www.gharki.com>
>
>
>
> On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <syedbahm@cisco.com 
> <ma...@cisco.com>> wrote:
>
>     One more question
>        I have a bunch of logger defines in logback.xml
>
>     e.g.
>
>
>       <logger name="io.netty" level="WARN"/>
>
>     I want them to appear when I do log:get ALL in karaf console.  But
>     the only
>     thing I see in Karaf console is
>
>     ---
>     Logger | Level
>     --------------
>     ROOT   | DEBUG
>     ---
>
>     Where should I specify the other loggers to show up in Karaf console
>
>
>
>
>
>     --
>     View this message in context:
>     http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
>     Sent from the Karaf - User mailing list archive at Nabble.com.
>
>


Re: pax-logback-service not working in karaf distribution

Posted by Srikanth Hugar <sr...@gmail.com>.
You could have look the link below, i have done it in karaf and its working
fine for me.

I used logback.xml file and added all my logback configurations in file.

http://www.gharki.com/2014/07/how-to-configure-pax-logging-to-use.html

Srikanth Hugar
www.gharki.com



On Thu, Nov 13, 2014 at 7:20 AM, syedbahm <sy...@cisco.com> wrote:

> One more question
>    I have a bunch of logger defines in logback.xml
>
> e.g.
>
>
>   <logger name="io.netty" level="WARN"/>
>
> I want them to appear when I do log:get ALL in karaf console.  But the only
> thing I see in Karaf console is
>
> ---
> Logger | Level
> --------------
> ROOT   | DEBUG
> ---
>
> Where should I specify the other loggers to show up in Karaf console
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
One more question
   I have a bunch of logger defines in logback.xml 

e.g. 

  
  <logger name="io.netty" level="WARN"/>

I want them to appear when I do log:get ALL in karaf console.  But the only
thing I see in Karaf console is 

---
Logger | Level
--------------
ROOT   | DEBUG
---

Where should I specify the other loggers to show up in Karaf console





--
View this message in context: http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073p4036374.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
Thx that seems to work !
-syed

On 10/22/2014 12:15 PM, Stuart McCulloch wrote:
> Hi Syed,
>
> I see you’re using pax-logging 1.7.2 … I’d recommend using at least 
> 1.7.3 because it has critical fixes for the logback backend:
>
> https://ops4j1.jira.com/browse/PAXLOGGING-178
>
> and if you want to use logback’s support for dynamic configuration 
> then use 1.8.0:
>
> https://ops4j1.jira.com/browse/PAXLOGGING-181
>
> Here’s an example logback.xml that works with pax-logging 1.7.3:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <configuration>
>
>       <appender name="osgi" 
> class="org.ops4j.pax.logging.logback.appender.PaxAppenderDelegate"/>
>
>       <appender name="console" 
> class="ch.qos.logback.core.ConsoleAppender">
>         <encoder>
>           <pattern>%d{"yyyy-MM-dd HH:mm:ss,SSSZ"} %-5p [%thread] 
> %X{userId} %c - %m%n</pattern>
>         </encoder>
>       </appender>
>
>       <appender name="logfile" 
> class="ch.qos.logback.core.rolling.RollingFileAppender">
> <File>${karaf.data}/log/karaf.log</File>
>         <Append>true</Append>
>         <encoder>
>           <pattern>%d{"yyyy-MM-dd HH:mm:ss,SSSZ"} %-5p [%thread] 
> %X{userId} %c - %m%n</pattern>
>         </encoder>
>         <rollingPolicy 
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> <fileNamePattern>${karaf.data}/log/karaf.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
>           <maxHistory>90</maxHistory>
>         </rollingPolicy>
>       </appender>
>
>       <root level=“INFO">
>         <appender-ref ref="osgi"/>
>         <appender-ref ref="console"/>
>         <appender-ref ref="logfile"/>
>       </root>
>
>     </configuration>
>
> The OSGi appender means logging output will be available to Karaf’s 
> log:display command.
>
> -- 
> Cheers, Stuart
>
> On Wednesday, 22 October 2014 at 19:58, syedbahm wrote:
>
>> Thx -- I have removed the pax-logging-service configuration from 
>> startup.properties. Even now I don't see the karaf.log getting 
>> populated.  Any other pointer to debug this issue. [Please note the 
>> first post has all details of how I have done the configuration]
>> ---
>> INFO: Trying to lock /root/opt/distribution-karaf-0.2.0-SNAPSHOT/lock
>> Oct 22, 2014 11:57:04 AM org.apache.karaf.main.lock.SimpleFileLock lock
>> INFO: Lock acquired
>> Oct 22, 2014 11:57:04 AM org.apache.karaf.main.Main$KarafLockCallback 
>> lockAquired
>> INFO: Lock acquired. Setting startlevel to 100
>>
>> ---
>>
>> thx
>> -syed
>> On 10/22/2014 10:58 AM, Stuart McCulloch wrote:
>>> Don’t install both pax-logging-logback and pax-logging-service
>>>
>>> pax-logging-service is the default service implementation that uses 
>>> Log4J, pax-logging-logback is an alternative service implementation 
>>> that uses logback - by installing both you’ll have two competing 
>>> service implementations
>>>
>>> I’d also recommend clearing out the bundle cache (under the data 
>>> directory) after modifying the startup.properties, to avoid picking 
>>> up any previously installed pax-logging-service bundle.
>>>
>>> -- 
>>> Cheers, Stuart
>>>
>>> On Wednesday, 22 October 2014 at 18:50, syedbahm wrote:
>>>
>>>> Hi,
>>>> After attempting to have a flume log4j appender but couldn't make 
>>>> it work as
>>>> discussed as part of this thread..
>>>> http://karaf.922171.n3.nabble.com/Enabling-Flume-log4j-appender-logging-in-Karaf-td4036033.html#a4036041
>>>> and not knowing how to further debug the same.. thought of trying the
>>>> pax-logback-service followed by using the logback-flume appender 
>>>> and I have
>>>> done the configuration as documented for pax-logback-service -- still I
>>>> don't see the karaf.log populated.. The last thing I see in 
>>>> karaf.log is as
>>>> shown below and nothing else.. Please provide any knobs that I can 
>>>> turn on
>>>> to debug this in Karaf. I have included the configuration I did 
>>>> below..
>>>>
>>>> ---
>>>>
>>>> Oct 22, 2014 10:32:46 AM org.apache.karaf.main.Main$KarafLockCallback
>>>> lockAquired
>>>> INFO: Lock acquired. Setting startlevel to 100
>>>>
>>>>
>>>> ----
>>>>
>>>> 1. When I check pax-logback service status it shows as Active as shown
>>>> below..
>>>>
>>>> bundle:list |grep Logback
>>>> 8 | Active | 8 | 1.7.2 | OPS4J Pax
>>>> Logging - Logback Service
>>>>
>>>> 2. My org.ops4.pax.logging.cfg looks like this
>>>>
>>>> ...
>>>> ...
>>>> # See the License for the specific language governing permissions and
>>>> # limitations under the License.
>>>> #
>>>> ################################################################################
>>>>
>>>> org.ops4j.pax.logging.logback.config.file=${karaf.base}/etc/logback.xml
>>>>
>>>>
>>>> 3. My logback.xml looks like this ..
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <configuration>
>>>>
>>>> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>>>> <encoder>
>>>> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
>>>> %msg%n</pattern>
>>>> </encoder>
>>>> </appender>
>>>>
>>>> <appender name="FILE"
>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>> <file>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.log</file>
>>>> <rollingPolicy
>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>> <fileNamePattern>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
>>>> <timeBasedFileNamingAndTriggeringPolicy
>>>> class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
>>>> <maxFileSize>100MB</maxFileSize>
>>>> </timeBasedFileNamingAndTriggeringPolicy>
>>>> <maxHistory>30</maxHistory>
>>>> </rollingPolicy>
>>>> <append>true</append>
>>>> <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
>>>> <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
>>>> <jsonFormatter
>>>> class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
>>>> <prettyPrint>true</prettyPrint>
>>>> </jsonFormatter>
>>>> <context>api</context>
>>>> <timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampFormat>
>>>> <timestampFormatTimezoneId>UTC</timestampFormatTimezoneId>
>>>> <appendLineSeparator>true</appendLineSeparator>
>>>> </layout>
>>>> </encoder>
>>>> </appender>
>>>> <root level="DEBUG">
>>>> <appender-ref ref="STDOUT"/>
>>>> <appender-ref ref="FILE"/>
>>>> </root>
>>>>
>>>> 4. my etc/startup.properties looks like this...
>>>>
>>>> mvn\:org.codehaus.janino/com.springsource.org.codehaus.commons.compiler/2.6.1
>>>> = 8
>>>> mvn\:org.ops4j.pax.logging/pax-logging-logback/1.7.2 = 8
>>>> mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
>>>> mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: 
>>>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073.html
>>>> Sent from the Karaf - User mailing list archive at Nabble.com 
>>>> <http://Nabble.com>.
>>>
>>
>


Re: pax-logback-service not working in karaf distribution

Posted by Stuart McCulloch <mc...@gmail.com>.
Hi Syed,  

I see you’re using pax-logging 1.7.2 … I’d recommend using at least 1.7.3 because it has critical fixes for the logback backend:

https://ops4j1.jira.com/browse/PAXLOGGING-178

and if you want to use logback’s support for dynamic configuration then use 1.8.0:

https://ops4j1.jira.com/browse/PAXLOGGING-181  

Here’s an example logback.xml that works with pax-logging 1.7.3:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>

      <appender name="osgi" class="org.ops4j.pax.logging.logback.appender.PaxAppenderDelegate"/>

      <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
          <pattern>%d{"yyyy-MM-dd HH:mm:ss,SSSZ"} %-5p [%thread] %X{userId} %c - %m%n</pattern>
        </encoder>
      </appender>

      <appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>${karaf.data}/log/karaf.log</File>
        <Append>true</Append>
        <encoder>
          <pattern>%d{"yyyy-MM-dd HH:mm:ss,SSSZ"} %-5p [%thread] %X{userId} %c - %m%n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
          <fileNamePattern>${karaf.data}/log/karaf.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
          <maxHistory>90</maxHistory>
        </rollingPolicy>
      </appender>

      <root level=“INFO">
        <appender-ref ref="osgi"/>
        <appender-ref ref="console"/>
        <appender-ref ref="logfile"/>
      </root>

    </configuration>

The OSGi appender means logging output will be available to Karaf’s log:display command.

--  
Cheers, Stuart


On Wednesday, 22 October 2014 at 19:58, syedbahm wrote:

> Thx -- I have removed the pax-logging-service configuration from startup.properties. Even now I don't see the karaf.log getting populated.  Any other pointer to debug this issue. [Please note the first post has all details of how I have done the configuration]
> ---
> INFO: Trying to lock /root/opt/distribution-karaf-0.2.0-SNAPSHOT/lock
> Oct 22, 2014 11:57:04 AM org.apache.karaf.main.lock.SimpleFileLock lock
> INFO: Lock acquired
> Oct 22, 2014 11:57:04 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
> INFO: Lock acquired. Setting startlevel to 100
>  
> ---
>  
> thx
> -syed
> On 10/22/2014 10:58 AM, Stuart McCulloch wrote:
> > Don’t install both pax-logging-logback and pax-logging-service  
> >  
> > pax-logging-service is the default service implementation that uses Log4J, pax-logging-logback is an alternative service implementation that uses logback - by installing both you’ll have two competing service implementations  
> >  
> > I’d also recommend clearing out the bundle cache (under the data directory) after modifying the startup.properties, to avoid picking up any previously installed pax-logging-service bundle.  
> >  
> > --   
> > Cheers, Stuart
> >  
> >  
> > On Wednesday, 22 October 2014 at 18:50, syedbahm wrote:
> >  
> > > Hi,
> > > After attempting to have a flume log4j appender but couldn't make it work as
> > > discussed as part of this thread..
> > > http://karaf.922171.n3.nabble.com/Enabling-Flume-log4j-appender-logging-in-Karaf-td4036033.html#a4036041
> > > and not knowing how to further debug the same.. thought of trying the
> > > pax-logback-service followed by using the logback-flume appender and I have
> > > done the configuration as documented for pax-logback-service -- still I
> > > don't see the karaf.log populated.. The last thing I see in karaf.log is as
> > > shown below and nothing else.. Please provide any knobs that I can turn on
> > > to debug this in Karaf. I have included the configuration I did below..  
> > >  
> > > ---  
> > >  
> > > Oct 22, 2014 10:32:46 AM org.apache.karaf.main.Main$KarafLockCallback  
> > > lockAquired
> > > INFO: Lock acquired. Setting startlevel to 100
> > >  
> > >  
> > > ----  
> > >  
> > > 1. When I check pax-logback service status it shows as Active as shown  
> > > below..  
> > >  
> > > bundle:list |grep Logback  
> > > 8 | Active | 8 | 1.7.2 | OPS4J Pax
> > > Logging - Logback Service  
> > >  
> > > 2. My org.ops4.pax.logging.cfg looks like this  
> > >  
> > > ...  
> > > ...
> > > # See the License for the specific language governing permissions and
> > > # limitations under the License.
> > > #
> > > ################################################################################
> > >  
> > > org.ops4j.pax.logging.logback.config.file=${karaf.base}/etc/logback.xml  
> > >  
> > >  
> > > 3. My logback.xml looks like this ..  
> > >  
> > > <?xml version="1.0" encoding="UTF-8"?>  
> > > <configuration>
> > >  
> > > <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">  
> > >  
> > > <encoder>
> > > <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> > > %msg%n</pattern>
> > > </encoder>
> > > </appender>
> > >  
> > > <appender name="FILE"  
> > > class="ch.qos.logback.core.rolling.RollingFileAppender">
> > >  
> > > <file>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.log</file>
> > > <rollingPolicy
> > > class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> > >  
> > >  
> > > <fileNamePattern>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
> > > <timeBasedFileNamingAndTriggeringPolicy
> > > class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
> > >  
> > > <maxFileSize>100MB</maxFileSize>
> > > </timeBasedFileNamingAndTriggeringPolicy>
> > >  
> > > <maxHistory>30</maxHistory>
> > > </rollingPolicy>
> > > <append>true</append>
> > >  
> > > <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
> > > <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
> > > <jsonFormatter
> > > class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
> > >  
> > > <prettyPrint>true</prettyPrint>
> > > </jsonFormatter>
> > > <context>api</context>
> > > <timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampFormat>
> > > <timestampFormatTimezoneId>UTC</timestampFormatTimezoneId>
> > > <appendLineSeparator>true</appendLineSeparator>
> > > </layout>
> > >  
> > > </encoder>
> > > </appender>
> > > <root level="DEBUG">
> > > <appender-ref ref="STDOUT"/>
> > > <appender-ref ref="FILE"/>
> > > </root>
> > >  
> > > 4. my etc/startup.properties looks like this...  
> > >  
> > > mvn\:org.codehaus.janino/com.springsource.org.codehaus.commons.compiler/2.6.1  
> > > = 8
> > > mvn\:org.ops4j.pax.logging/pax-logging-logback/1.7.2 = 8
> > > mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
> > > mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> > > --  
> > > View this message in context: http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073.html
> > > Sent from the Karaf - User mailing list archive at Nabble.com (http://Nabble.com).
> > >  
> > >  
> > >  
> >  
> >  
>  


Re: pax-logback-service not working in karaf distribution

Posted by syedbahm <sy...@cisco.com>.
Thx -- I have removed the pax-logging-service configuration from 
startup.properties. Even now I don't see the karaf.log getting 
populated.  Any other pointer to debug this issue. [Please note the 
first post has all details of how I have done the configuration]
---
INFO: Trying to lock /root/opt/distribution-karaf-0.2.0-SNAPSHOT/lock
Oct 22, 2014 11:57:04 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Lock acquired
Oct 22, 2014 11:57:04 AM org.apache.karaf.main.Main$KarafLockCallback 
lockAquired
INFO: Lock acquired. Setting startlevel to 100

---

thx
-syed
On 10/22/2014 10:58 AM, Stuart McCulloch wrote:
> Don’t install both pax-logging-logback and pax-logging-service
>
> pax-logging-service is the default service implementation that uses 
> Log4J, pax-logging-logback is an alternative service implementation 
> that uses logback - by installing both you’ll have two competing 
> service implementations
>
> I’d also recommend clearing out the bundle cache (under the data 
> directory) after modifying the startup.properties, to avoid picking up 
> any previously installed pax-logging-service bundle.
>
> -- 
> Cheers, Stuart
>
> On Wednesday, 22 October 2014 at 18:50, syedbahm wrote:
>
>> Hi,
>> After attempting to have a flume log4j appender but couldn't make it 
>> work as
>> discussed as part of this thread..
>> http://karaf.922171.n3.nabble.com/Enabling-Flume-log4j-appender-logging-in-Karaf-td4036033.html#a4036041
>> and not knowing how to further debug the same.. thought of trying the
>> pax-logback-service followed by using the logback-flume appender and 
>> I have
>> done the configuration as documented for pax-logback-service -- still I
>> don't see the karaf.log populated.. The last thing I see in karaf.log 
>> is as
>> shown below and nothing else.. Please provide any knobs that I can 
>> turn on
>> to debug this in Karaf. I have included the configuration I did below..
>>
>> ---
>>
>> Oct 22, 2014 10:32:46 AM org.apache.karaf.main.Main$KarafLockCallback
>> lockAquired
>> INFO: Lock acquired. Setting startlevel to 100
>>
>>
>> ----
>>
>> 1. When I check pax-logback service status it shows as Active as shown
>> below..
>>
>> bundle:list |grep Logback
>> 8 | Active | 8 | 1.7.2 | OPS4J Pax
>> Logging - Logback Service
>>
>> 2. My org.ops4.pax.logging.cfg looks like this
>>
>> ...
>> ...
>> # See the License for the specific language governing permissions and
>> # limitations under the License.
>> #
>> ################################################################################
>>
>> org.ops4j.pax.logging.logback.config.file=${karaf.base}/etc/logback.xml
>>
>>
>> 3. My logback.xml looks like this ..
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration>
>>
>> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>> <encoder>
>> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
>> %msg%n</pattern>
>> </encoder>
>> </appender>
>>
>> <appender name="FILE"
>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>> <file>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.log</file>
>> <rollingPolicy
>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>> <fileNamePattern>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
>> <timeBasedFileNamingAndTriggeringPolicy
>> class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
>> <maxFileSize>100MB</maxFileSize>
>> </timeBasedFileNamingAndTriggeringPolicy>
>> <maxHistory>30</maxHistory>
>> </rollingPolicy>
>> <append>true</append>
>> <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
>> <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
>> <jsonFormatter
>> class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
>> <prettyPrint>true</prettyPrint>
>> </jsonFormatter>
>> <context>api</context>
>> <timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampFormat>
>> <timestampFormatTimezoneId>UTC</timestampFormatTimezoneId>
>> <appendLineSeparator>true</appendLineSeparator>
>> </layout>
>> </encoder>
>> </appender>
>> <root level="DEBUG">
>> <appender-ref ref="STDOUT"/>
>> <appender-ref ref="FILE"/>
>> </root>
>>
>> 4. my etc/startup.properties looks like this...
>>
>> mvn\:org.codehaus.janino/com.springsource.org.codehaus.commons.compiler/2.6.1
>> = 8
>> mvn\:org.ops4j.pax.logging/pax-logging-logback/1.7.2 = 8
>> mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
>> mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073.html
>> Sent from the Karaf - User mailing list archive at Nabble.com 
>> <http://Nabble.com>.
>


Re: pax-logback-service not working in karaf distribution

Posted by Stuart McCulloch <mc...@gmail.com>.
Don’t install both pax-logging-logback and pax-logging-service

pax-logging-service is the default service implementation that uses Log4J, pax-logging-logback is an alternative service implementation that uses logback - by installing both you’ll have two competing service implementations  

I’d also recommend clearing out the bundle cache (under the data directory) after modifying the startup.properties, to avoid picking up any previously installed pax-logging-service bundle.

--  
Cheers, Stuart


On Wednesday, 22 October 2014 at 18:50, syedbahm wrote:

> Hi,
> After attempting to have a flume log4j appender but couldn't make it work as
> discussed as part of this thread..
> http://karaf.922171.n3.nabble.com/Enabling-Flume-log4j-appender-logging-in-Karaf-td4036033.html#a4036041
> and not knowing how to further debug the same.. thought of trying the
> pax-logback-service followed by using the logback-flume appender and I have
> done the configuration as documented for pax-logback-service -- still I
> don't see the karaf.log populated.. The last thing I see in karaf.log is as
> shown below and nothing else.. Please provide any knobs that I can turn on
> to debug this in Karaf. I have included the configuration I did below..  
>  
> ---
>  
> Oct 22, 2014 10:32:46 AM org.apache.karaf.main.Main$KarafLockCallback
> lockAquired
> INFO: Lock acquired. Setting startlevel to 100
>  
>  
> ----
>  
> 1. When I check pax-logback service status it shows as Active as shown
> below..  
>  
> bundle:list |grep Logback
> 8 | Active | 8 | 1.7.2 | OPS4J Pax
> Logging - Logback Service  
>  
> 2. My org.ops4.pax.logging.cfg looks like this  
>  
> ...
> ...
> # See the License for the specific language governing permissions and
> # limitations under the License.
> #
> ################################################################################
>  
> org.ops4j.pax.logging.logback.config.file=${karaf.base}/etc/logback.xml
>  
>  
> 3. My logback.xml looks like this ..  
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
>  
> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>  
> <encoder>
> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> %msg%n</pattern>
> </encoder>
> </appender>
>  
> <appender name="FILE"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>  
> <file>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.log</file>
> <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>  
>  
> <fileNamePattern>/root/opt/distribution-karaf-0.2.0-SNAPSHOT/data/log/karaf.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
> <timeBasedFileNamingAndTriggeringPolicy
> class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
>  
> <maxFileSize>100MB</maxFileSize>
> </timeBasedFileNamingAndTriggeringPolicy>
>  
> <maxHistory>30</maxHistory>
> </rollingPolicy>
> <append>true</append>
>  
> <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
> <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
> <jsonFormatter
> class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
>  
> <prettyPrint>true</prettyPrint>
> </jsonFormatter>
> <context>api</context>
> <timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampFormat>
> <timestampFormatTimezoneId>UTC</timestampFormatTimezoneId>
> <appendLineSeparator>true</appendLineSeparator>
> </layout>
>  
> </encoder>
> </appender>
> <root level="DEBUG">
> <appender-ref ref="STDOUT"/>
> <appender-ref ref="FILE"/>
> </root>
>  
> 4. my etc/startup.properties looks like this...  
>  
> mvn\:org.codehaus.janino/com.springsource.org.codehaus.commons.compiler/2.6.1
> = 8
> mvn\:org.ops4j.pax.logging/pax-logging-logback/1.7.2 = 8
> mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
> mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://karaf.922171.n3.nabble.com/pax-logback-service-not-working-in-karaf-distribution-tp4036073.html
> Sent from the Karaf - User mailing list archive at Nabble.com (http://Nabble.com).
>  
>