Hi, ok, let's put it this way. You have a certain OSGi application that is in need of a logging api. If your run-time container doesn't provide that you can use pax-logging and deploy it by yourself. But if your run-time container already does provide a logging api you are in no need for it. For example take Apache Karaf as OSGi runtime, it already does provide pax-logging as the logging api and implementation. Now you only make your OSGi application dependend on the logging api you are in need of.
for example: <import-package>org.apache.log4j.*</import-package> Your OSGi run-time will provide you with the needed "infrastructure" If you have a bare OSGi container like a equinox framework bundle which you start by your own then you are in need of a logging api and impl (pax-logging would fit here) Now you try to run your application inside the JBoss application server which also provides a logging api. It's already optimized to run with it's own logging layer. Now you only need to make your application dependent on the api. No need to provide your own implementation or api with your application cause it's already there. And just for the records, this has always been an issue with various JEE Application servers if you deploy another logging framework inside a war archive it might happen that this application server doesn't work right, or doesn't log right. For JBoss (and I have been working with JBoss 3 to 5) this has always been an issue. Other Application Servers like IBM Websphere 3 to 4 have also been picky about this. I only think the Bea weblogic 6 to 8 didn't react on it or by the time I used those appserver I already made sure I don't have a logging api inside my war archive. Regards, Achim 2011/8/2 Arnaud MERGEY <[email protected]>: > Hello, > I have done some additional tests on this. > > The issue occurs also in previous version of JBoss ( 5 and 6). > Having pax-logging service bundle hang the whole server as well (same > stackoverflow error than with JBoss 7), the issue gone by removing > pax-logging service bundle. > > So I tested back in 7 as bundles can be direcly deployed into the container, > it is easier to reproduce the issue. > > As I understand, when pax-logging api only is deployed, pax direcltly use > System.out to output logs. I have tested and in this case it works, but if > both are deployed (api and service bundles) > pax-logging use log4j to output logs. In this case stack overflow occurs > when pax try to log something on stdout through its log4j logger (probably > default root logger for pax when there is no configuration) > In this case the logs got through some Jboss classes, then get back to pax, > then get back to jboss, .... until the stack overflow. > > According to some posts in JBoss forum it seems that there should not be any > root logger configured for application that comes with their own log4j > configuration. > So if I launch JBoss with > -Dorg.ops4j.pax.logging.DefaultServiceLog.level=FATAL the issue gone, > because it prevents some logs to go through default root logger, until I can > create a log configuration without stdout root logger. > > Logger.log(Level, String) line: 434 > LoggingWriter(AbstractLoggingWriter).write(char[], int, int) line: 71 > LoggingOutputStream(WriterOutputStream).finish() line: 137 > LoggingOutputStream(WriterOutputStream).write(byte[], int, int) line: 106 > PrintStream.write(byte[], int, int) line: 430 > StdioContext$1(StdioContext$DelegatingPrintStream).write(byte[], int, int) > line: 225 > StreamEncoder.writeBytes() line: 202 [local variables unavailable] > StreamEncoder.implWrite(char[], int, int) line: 263 > StreamEncoder.write(char[], int, int) line: 106 > StreamEncoder.write(String, int, int) line: 116 > OutputStreamWriter.write(String, int, int) line: 203 > OutputStreamWriter(Writer).write(String) line: 140 > QuietWriter.write(String) line: 48 > ConsoleAppender(WriterAppender).subAppend(LoggingEvent) line: 310 > ConsoleAppender(WriterAppender).append(LoggingEvent) line: 162 > ConsoleAppender(AppenderSkeleton).doAppend(LoggingEvent) line: 251 > AppenderAttachableImpl.appendLoopOnAppenders(LoggingEvent) line: 66 > Logger(Category).callAppenders(LoggingEvent) line: 206 > Logger(Category).forcedLog(String, Priority, Object, Throwable) line: 391 > Logger(Category).log(String, Priority, Object, Throwable) line: 856 > PaxLoggerImpl.log(Priority, Object, Throwable) line: 231 > JdkHandler.publish(LogRecord) line: 106 > LoggerNode.publish(ExtLogRecord) line: 283 > LoggerNode.publish(ExtLogRecord) line: 291 > Logger.logRaw(ExtLogRecord) line: 649 > Logger.log(Level, String) line: 434 > LoggingWriter(AbstractLoggingWriter).write(char[], int, int) line: 71 > LoggingOutputStream(WriterOutputStream).finish() line: 137 > LoggingOutputStream(WriterOutputStream).flush() line: 155 > PrintStream.write(byte[], int, int) line: 432 > StdioContext$1(StdioContext$DelegatingPrintStream).write(byte[], int, int) > line: 225 > StreamEncoder.writeBytes() line: 202 [local variables unavailable] > StreamEncoder.implFlushBuffer() line: 272 [local variables unavailable] > StreamEncoder.implFlush() line: 276 [local variables unavailable] > StreamEncoder.flush() line: 122 [local variables unavailable] > OutputStreamWriter.flush() line: 212 [local variables unavailable] > QuietWriter.flush() line: 59 > ConsoleAppender(WriterAppender).subAppend(LoggingEvent) line: 324 > ConsoleAppender(WriterAppender).append(LoggingEvent) line: 162 > ConsoleAppender(AppenderSkeleton).doAppend(LoggingEvent) line: 251 > AppenderAttachableImpl.appendLoopOnAppenders(LoggingEvent) line: 66 > Logger(Category).callAppenders(LoggingEvent) line: 206 > Logger(Category).forcedLog(String, Priority, Object, Throwable) line: 391 > Logger(Category).log(String, Priority, Object, Throwable) line: 856 > PaxLoggerImpl.debug(String, Throwable) line: 132 > PaxLoggingServiceImpl.log(Bundle, ServiceReference, int, String, Throwable) > line: 149 > PaxLoggingServiceImpl.log(Bundle, int, String, Throwable) line: 115 > FrameworkHandler.bundleChanged(BundleEvent) line: 93 > > > > > Le 30/07/2011 22:40, Ales Justin a écrit : >> >> I suggest you push this issue to JBossAS7 user forum. >> >> btw: how does log4j get in? >> >> In JBossAS7 there is no more "big-ball-o-mud" classloading aka global >> libs, >> but you need to explitity ref modules via new module CL system. >> Though some modules are transparently added to you deployment; e.g. javaee >> api, etc >> I don't think log4j is the default logging used. >> >> Sent from my iPad >> >> On Jul 30, 2011, at 22:22, Achim Nierbeck<[email protected]> wrote: >> >>> HI Arnaud, >>> >>> as far as I can remember developing applications with JBoss it has always >>> been an issue when providing another log4j jar. >>> So when I build applications for std. WARs I always removed the log4j jar >>> due to issues with JBoss. >>> In a EAR it was always working out due to the way the classloader works. >>> >>> Regarding your use-case I can follow that, still I would expect the >>> Application Servers to provide this peace of "infrastructure". >>> Take Apache Karaf for example as the run-time for OSGi it provides it's >>> logging through Pax Loggin out of the box. >>> JBoss does provide the log4j api, which causes you trouble now. >>> I'm pretty sure all the other Application Server do also. >>> If I remember right (it's been quite some time now) I also had some sort >>> of issues deploying WARs containing log4j jars on a >>> Websphere Application Server (it's been WS-4 or 5, so quite some time ago >>> :-) ) >>> >>> Regards, Achim >>> >>> Am 30.07.2011 19:37, schrieb Arnaud MERGEY: >>>> >>>> Hi >>>> >>>> My application is not specific to JBoss and is supposed to be deployable >>>> in several OSGI container or Application server. >>>> I have several deployment use case for the application, either as a >>>> legacy WAR (using equinox servlet bridge), either as a WAB. >>>> I use pax-logging, because I needed an unified way to configure logging >>>> whatever the deployment scenario and the container choosed, but also, >>>> because it makes logging configuration easier for my bundles. >>>> >>>> Until now, It worked perfectly in several container, until I tried it on >>>> JBoss 7. So during my tests, in every case (WAR or WAB deployment), having >>>> pax-logging service bundle hanged the whole JBoss 7 container. If I remove >>>> this bundle from my app it works. So I deployed pax-logging only, just to >>>> see if I had the same issue and the purpose of thid was just an easy way to >>>> reproduce the issue. >>>> >>>> Hope this clarify my use case >>>> Regards, >>>> Arnaud >>>> >>>> >>>> Le 30/07/2011 09:48, Achim Nierbeck a écrit : >>>>> >>>>> Hi, >>>>> >>>>> hm, why would you need pax-logging inside a JBoss, I'd expect JBoss to >>>>> provide the logging API out of the box. >>>>> Though I haven't looked into JBoss 7 yet. Back when I used 4 and 5 a >>>>> logging api like log4j >>>>> was brought to the container out of the box. So I'd expect JBoss to >>>>> provide that. >>>>> >>>>> So what would be your Usecase of "replacing" the provided Logging API? >>>>> Or is there something else that you think you need pax logging as the >>>>> logging api inside JBoss? >>>>> >>>>> regards, Achim >>>>> >>>>> Am 29.07.2011 15:37, schrieb Arnaud MERGEY: >>>>>> >>>>>> Hello, >>>>>> Trying to deploy an application using pax-logging (1.6.3), it seems to >>>>>> hang JBoss AS (7) >>>>>> By waiting some time I had the stackoverflow stack trace above, os I >>>>>> suspected something wrong with pax-logging service. >>>>>> If I remove pax-logging service from my application, it works fine. >>>>>> >>>>>> As JBoss 7 allow to deploy bundles direcly, I tried to deploy >>>>>> pax-logging-api and pax-logging-service directly and it seems to hand >>>>>> Jboss as well, the server stop to answer, but anything is log >>>>>> >>>>>> A simple way t reproduce, start a JBoss AS 7 server, go to the JBoss >>>>>> console (http://127.0.0.1:9990/console/App.html), the console page >>>>>> should be displayed >>>>>> Copy pax-logging-api and pax-logging-service in >>>>>> $JBOSS_HOME/standalone/deployments, wait for pax logging bundles to be >>>>>> deployed >>>>>> Then try to go to the jboss console again, it does not respond >>>>>> anymore. >>>>>> >>>>>> Is it a known issue ? is there any special configuration to have pax >>>>>> logging service to work with JBoss 7 ? >>>>>> Regards, >>>>>> Arnaud >>>>>> >>>>>> 11:52:19,996 INFO [stdout] -logging-service - BundleEvent STARTED >>>>>> >>>>>> 11:52:19,996 INFO [stdout] j.pax.logging.pax-logging-service - >>>>>> BundleEvent STARTED >>>>>> >>>>>> 11:52:20,005 INFO [stdout] j.pax.logging.pax-logging-service - >>>>>> BundleEvent STARTED >>>>>> >>>>>> 11:52:20,005 INFO [stdout] java.lang.StackOverflowError >>>>>> >>>>>> 11:52:20,005 INFO [stdout] at >>>>>> org.apache.log4j.CategoryKey.<init>(CategoryKey.java:30) >>>>>> >>>>>> 11:52:20,006 INFO [stdout] at >>>>>> org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:266) >>>>>> >>>>>> 11:52:20,006 INFO [stdout] at >>>>>> org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:247) >>>>>> >>>>>> 11:52:20,006 INFO [stdout] at >>>>>> org.apache.log4j.LogManager.getLogger(LogManager.java:228) >>>>>> >>>>>> 11:52:20,007 INFO [stdout] at >>>>>> org.apache.log4j.Logger.getLogger(Logger.java:104) >>>>>> >>>>>> 11:52:20,007 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl.getLogger(PaxLoggingServiceImpl.java:75) >>>>>> >>>>>> 11:52:20,007 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.JdkHandler.publish(JdkHandler.java:78) >>>>>> >>>>>> 11:52:20,007 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:283) >>>>>> >>>>>> 11:52:20,007 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) >>>>>> >>>>>> 11:52:20,008 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.logRaw(Logger.java:649) >>>>>> >>>>>> 11:52:20,008 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.log(Logger.java:434) >>>>>> >>>>>> 11:52:20,008 INFO [stdout] at >>>>>> >>>>>> org.jboss.stdio.AbstractLoggingWriter.write(AbstractLoggingWriter.java:71) >>>>>> >>>>>> 11:52:20,009 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.finish(WriterOutputStream.java:137) >>>>>> >>>>>> 11:52:20,009 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.write(WriterOutputStream.java:106) >>>>>> >>>>>> 11:52:20,009 INFO [stdout] at >>>>>> java.io.PrintStream.write(PrintStream.java:430) >>>>>> >>>>>> 11:52:20,009 INFO [stdout] at >>>>>> >>>>>> org.jboss.stdio.StdioContext$DelegatingPrintStream.write(StdioContext.java:225) >>>>>> >>>>>> 11:52:20,010 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) >>>>>> >>>>>> 11:52:20,010 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263) >>>>>> >>>>>> 11:52:20,011 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106) >>>>>> >>>>>> 11:52:20,011 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116) >>>>>> >>>>>> 11:52:20,011 INFO [stdout] at >>>>>> java.io.OutputStreamWriter.write(OutputStreamWriter.java:203) >>>>>> >>>>>> 11:52:20,011 INFO [stdout] at >>>>>> java.io.Writer.write(Writer.java:140) >>>>>> >>>>>> 11:52:20,012 INFO [stdout] at >>>>>> org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:48) >>>>>> >>>>>> 11:52:20,012 INFO [stdout] at >>>>>> org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310) >>>>>> >>>>>> 11:52:20,012 INFO [stdout] at >>>>>> org.apache.log4j.WriterAppender.append(WriterAppender.java:162) >>>>>> >>>>>> 11:52:20,012 INFO [stdout] at >>>>>> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) >>>>>> >>>>>> 11:52:20,013 INFO [stdout] at >>>>>> >>>>>> org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66) >>>>>> >>>>>> 11:52:20,013 INFO [stdout] at >>>>>> org.apache.log4j.Category.callAppenders(Category.java:206) >>>>>> >>>>>> 11:52:20,013 INFO [stdout] at >>>>>> org.apache.log4j.Category.forcedLog(Category.java:391) >>>>>> >>>>>> 11:52:20,013 INFO [stdout] at >>>>>> org.apache.log4j.Category.log(Category.java:856) >>>>>> >>>>>> 11:52:20,014 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.PaxLoggerImpl.log(PaxLoggerImpl.java:231) >>>>>> >>>>>> 11:52:20,014 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.JdkHandler.publish(JdkHandler.java:106) >>>>>> >>>>>> 11:52:20,014 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:283) >>>>>> >>>>>> 11:52:20,014 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) >>>>>> >>>>>> 11:52:20,015 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.logRaw(Logger.java:649) >>>>>> >>>>>> 11:52:20,015 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.log(Logger.java:434) >>>>>> >>>>>> 11:52:20,015 INFO [stdout] at >>>>>> >>>>>> org.jboss.stdio.AbstractLoggingWriter.write(AbstractLoggingWriter.java:71) >>>>>> >>>>>> 11:52:20,015 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.finish(WriterOutputStream.java:137) >>>>>> >>>>>> 11:52:20,016 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.write(WriterOutputStream.java:106) >>>>>> >>>>>> 11:52:20,016 INFO [stdout] at >>>>>> java.io.PrintStream.write(PrintStream.java:430) >>>>>> >>>>>> >>>>>> ... >>>>>> ... >>>>>> ... >>>>>> >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:48) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.WriterAppender.append(WriterAppender.java:162) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> >>>>>> org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.Category.callAppenders(Category.java:206) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.Category.forcedLog(Category.java:391) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> org.apache.log4j.Category.log(Category.java:856) >>>>>> >>>>>> 11:52:21,419 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.PaxLoggerImpl.log(PaxLoggerImpl.java:231) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> >>>>>> org.ops4j.pax.logging.service.internal.JdkHandler.publish(JdkHandler.java:106) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:283) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.logRaw(Logger.java:649) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.logmanager.Logger.log(Logger.java:434) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> >>>>>> org.jboss.stdio.AbstractLoggingWriter.write(AbstractLoggingWriter.java:71) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.finish(WriterOutputStream.java:137) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> org.jboss.stdio.WriterOutputStream.write(WriterOutputStream.java:106) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> java.io.PrintStream.write(PrintStream.java:430) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> >>>>>> org.jboss.stdio.StdioContext$DelegatingPrintStream.write(StdioContext.java:225) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) >>>>>> >>>>>> 11:52:21,420 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263) >>>>>> >>>>>> 11:52:21,421 INFO [stdout] at >>>>>> sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106) >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> general mailing list >>>>>> [email protected] >>>>>> http://lists.ops4j.org/mailman/listinfo/general >>>> >>>> _______________________________________________ >>>> general mailing list >>>> [email protected] >>>> http://lists.ops4j.org/mailman/listinfo/general >>> >>> -- >>> -- >>> *Achim Nierbeck* >>> >>> >>> 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/> >>> >>> >>> _______________________________________________ >>> general mailing list >>> [email protected] >>> http://lists.ops4j.org/mailman/listinfo/general >> >> _______________________________________________ >> general mailing list >> [email protected] >> http://lists.ops4j.org/mailman/listinfo/general > > > _______________________________________________ > general mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/general > -- -- *Achim Nierbeck* 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/> _______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
