KARAF 4.1.5 & pax-logging-service

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

KARAF 4.1.5 & pax-logging-service

munishgupta.asr
Hi All,

for our project, we are using KARAF 4.0.9 for now and decided to upgrade it
to 4.1.5.
we have a customer appender which is used as a fragment with
pax-logging-service bundle.

After upgrading to KARAF 4.1.5, it is failing to find pax-logging-service
and service is not getting downloaded in system folder using maven.  rather
I could see 2 different folders in system path.
Pax-logging-logback
pax-logging-log4j2

have we removed support of pax-logging-service with KARAF 4.1.x onwards.
What shall i use now as fragment-host bundle to get the build generated?

Regards

Munish





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

jbonofre
Hi,

As we switched to log4j2 configuration style, we now use pax-logging-log4j2.

pax-logging-log4j2 replaces the pax-logging-service (log4j1 style)
implementation of pax-logging-api.

I guess you use a fragment to use a log4j appender ?

If so, you should update your appender to log4j2 style and attach to
pax-logging-log4j2.
Even better is to implement your PaxAppender (based on the pax-logging-api).

Regards
JB

On 03/02/2018 09:58 AM, munishgupta.asr wrote:

> Hi All,
>
> for our project, we are using KARAF 4.0.9 for now and decided to upgrade it
> to 4.1.5.
> we have a customer appender which is used as a fragment with
> pax-logging-service bundle.
>
> After upgrading to KARAF 4.1.5, it is failing to find pax-logging-service
> and service is not getting downloaded in system folder using maven.  rather
> I could see 2 different folders in system path.
> Pax-logging-logback
> pax-logging-log4j2
>
> have we removed support of pax-logging-service with KARAF 4.1.x onwards.
> What shall i use now as fragment-host bundle to get the build generated?
>
> Regards
>
> Munish
>
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

munishgupta.asr
Thanks for the quick response.

we are extending the  org.apache.log4j.FileAppender and
org.apache.log4j.nt.NTEventLogAppender.
for now, my fragment pom file is using service as host bundle.
<configuration>
          <instructions>
            <Bundle-Name>${project.artifactId}</Bundle-Name>
           
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Export-Package>com.good.gcs.core.logging</Export-Package>
            <Import-Package>!*</Import-Package>
           
<Fragment-Host>org.ops4j.pax.logging.pax-logging-service</Fragment-Host>
            <_failok>true</_failok>
          </instructions>
        </configuration>


So that means I should update my fragment-host to "pax-logging-log4j2" and
updated appender to log4j2 style?

what is the use of pax-logging-logback? Do i need to do anything with that
also?




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

jbonofre
Hi,

no need to deal with logback (that's another layer).

Correct for log4j2 attachment & style.

Regards
JB

On 03/02/2018 10:20 AM, munishgupta.asr wrote:

> Thanks for the quick response.
>
> we are extending the  org.apache.log4j.FileAppender and
> org.apache.log4j.nt.NTEventLogAppender.
> for now, my fragment pom file is using service as host bundle.
> <configuration>
>           <instructions>
>             <Bundle-Name>${project.artifactId}</Bundle-Name>
>            
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>             <Bundle-Version>${project.version}</Bundle-Version>
>             <Export-Package>com.good.gcs.core.logging</Export-Package>
>             <Import-Package>!*</Import-Package>
>            
> <Fragment-Host>org.ops4j.pax.logging.pax-logging-service</Fragment-Host>
>             <_failok>true</_failok>
>           </instructions>
>         </configuration>
>
>
> So that means I should update my fragment-host to "pax-logging-log4j2" and
> updated appender to log4j2 style?
>
> what is the use of pax-logging-logback? Do i need to do anything with that
> also?
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

munishgupta.asr
Thanks JB.

I will try and get back with results.

Regards
Munish



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

jbonofre
Thanks, please let me know if you have any issue.

Regards
JB

On 03/02/2018 10:33 AM, munishgupta.asr wrote:

> Thanks JB.
>
> I will try and get back with results.
>
> Regards
> Munish
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

Matt Sicker
If you have a custom log4j 1 appender, there's limited support in
log4j-1.2-api which you can add on to the log4j2 stuff, though I'm not sure
how that would interact without some fragment hackery.

On 2 March 2018 at 03:34, Jean-Baptiste Onofré <[hidden email]> wrote:

> Thanks, please let me know if you have any issue.
>
> Regards
> JB
>
> On 03/02/2018 10:33 AM, munishgupta.asr wrote:
> > Thanks JB.
> >
> > I will try and get back with results.
> >
> > Regards
> > Munish
> >
> >
> >
> > --
> > Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
> >
>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

munishgupta.asr
Hi,

Yes it looks creating a custom appender is very different with log4j2 and
not like that with log4j1 where we were using pax-logging-service as
fragment-host with our custom bundle.
we don't have AppenderSkeleton class also here.

how shall i approach it now? do we have any adapter kind of thing here to
continue using same code or we will have to rewrite our logging module.

Regards
Munish




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

munishgupta.asr
In reply to this post by jbonofre
Hello JB,

As you suggested and mentioned like that "If so, you should update your
appender to log4j2 style and attach to pax-logging-log4j2".

I was trying to do that but it seems creating custom appenders is very
different here. earlier I was extending fileappenders and providing
configuration parameters in constructor through CFG file. but now it looks
very different.

is there sample examples to refer about how to create custom file appenders
and attach it with pax-logging-log4j2 as fragment?

or is there any way to still use pax-logging-service with KARAF 4.1.x
onwards as we are OK with log4j1 implementation.

can you please help? kindly answer.

Regards
Munish  



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

Matt Sicker
The plugin docs for log4j2 itself [1] covers more about it. If you’re
trying to extend an existing appender, you’ll have to extend its
corresponding manager class instead (an appender in v2 is more of a
configuration mechanism while the manager handles the underlying data
sink). I’d also suggest discussing with the Apache list if you’d like to
integrate or request your feature upstream.

[1]: http://logging.apache.org/log4j/2.x/manual/plugins.html

On Tue, Mar 6, 2018 at 21:18, munishgupta.asr <[hidden email]>
wrote:

> Hello JB,
>
> As you suggested and mentioned like that "If so, you should update your
> appender to log4j2 style and attach to pax-logging-log4j2".
>
> I was trying to do that but it seems creating custom appenders is very
> different here. earlier I was extending fileappenders and providing
> configuration parameters in constructor through CFG file. but now it looks
> very different.
>
> is there sample examples to refer about how to create custom file appenders
> and attach it with pax-logging-log4j2 as fragment?
>
> or is there any way to still use pax-logging-service with KARAF 4.1.x
> onwards as we are OK with log4j1 implementation.
>
> can you please help? kindly answer.
>
> Regards
> Munish
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>
--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

munishgupta.asr
In reply to this post by munishgupta.asr
Hi Matt,

Thanks for guiding on Same like pax-logging-service issue. we are in good
shape for that.

same like that, earlier org.springframework libraries were also downloaded
and started when we were running the package. we were defining these as
bootfeatures during prepare package.
<groupId>org.apache.karaf.tooling</groupId>
    <artifactId>karaf-maven-plugin</artifactId>
    <version>${apache-karaf.maven.plugin.version}</version>
    <extensions>true</extensions>
    <configuration>
     <ignoreDependencyFlag>false</ignoreDependencyFlag>
     <bootFeatures>    
      <feature>framework</feature>
      <feature>standard</feature>
      <feature>eventadmin</feature>
      <feature>jasypt-encryption</feature>
      <feature>config</feature>  
      <feature>jpa/1.0.4</feature>
      <feature>openjpa</feature>
      <feature>transaction</feature>
      <feature>spring</feature>
      <feature>spring-dm</feature>
      <feature>spring-dm-web</feature>
      <feature>scr</feature>
      <feature>http</feature>
      <feature>war</feature>
     </bootFeatures>

but after upgrading to 4.2.0, These spring libraries are not getting
downloaded and started. When i start my project, it fails with the OSGI
wiring issues for spring dependency like org.springframework.web.servlet

then I am trying to add it as OSGI bundle in features.xml by adding like
bundle
start-level="85">wrap:mvn:org.springframework/spring-webmvc/4.3.7.RELEASE</bundle>

but it still fails. Can you give any pointers here?





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
Reply | Threaded
Open this post in threaded view
|

Re: KARAF 4.1.5 & pax-logging-service

Matt Sicker
I'm more familiar with log4j myself. However, OSGi issues with Spring seem
to be a common issue thanks to Spring snubbing OSGi for a while. Chances
are that this has improved a bit in Spring 5 thanks to Java 9 modules
forcing them to embrace modularity again, though that doesn't help in this
scenario, sorry.

On 13 March 2018 at 23:23, munishgupta.asr <[hidden email]>
wrote:

> Hi Matt,
>
> Thanks for guiding on Same like pax-logging-service issue. we are in good
> shape for that.
>
> same like that, earlier org.springframework libraries were also downloaded
> and started when we were running the package. we were defining these as
> bootfeatures during prepare package.
> <groupId>org.apache.karaf.tooling</groupId>
>     <artifactId>karaf-maven-plugin</artifactId>
>     <version>${apache-karaf.maven.plugin.version}</version>
>     <extensions>true</extensions>
>     <configuration>
>      <ignoreDependencyFlag>false</ignoreDependencyFlag>
>      <bootFeatures>
>       <feature>framework</feature>
>       <feature>standard</feature>
>       <feature>eventadmin</feature>
>       <feature>jasypt-encryption</feature>
>       <feature>config</feature>
>       <feature>jpa/1.0.4</feature>
>       <feature>openjpa</feature>
>       <feature>transaction</feature>
>       <feature>spring</feature>
>       <feature>spring-dm</feature>
>       <feature>spring-dm-web</feature>
>       <feature>scr</feature>
>       <feature>http</feature>
>       <feature>war</feature>
>      </bootFeatures>
>
> but after upgrading to 4.2.0, These spring libraries are not getting
> downloaded and started. When i start my project, it fails with the OSGI
> wiring issues for spring dependency like org.springframework.web.servlet
>
> then I am trying to add it as OSGI bundle in features.xml by adding like
> bundle
> start-level="85">wrap:mvn:org.springframework/spring-webmvc/
> 4.3.7.RELEASE</bundle>
>
> but it still fails. Can you give any pointers here?
>
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>



--
Matt Sicker <[hidden email]>