I'm afraid I know very little about OSGi; I believe it uses separate class
loaders for each module? In which case it will not work very well with
sysout-over-slf4j at all. I'd need to know more about OSGi in general and how
SLF4J works with OSGi's class loading in particular in order to tackle it.
In terms of the error - it looks as if something is printing to System.out
without a line break at the end sufficiently often that the buffer it maintains
inside is blowing up. I'd guess that felix is doing something like:
System.out.println("message\n>");
in order to leave a > style prompt after each response. Because that doesn't
end with a line break sysout-over-slf4j assumes you want it to be built up into
a single log message - which is presumably getting so large it blows up with an
OutOfMemory error.
Sysout-over-slf4j 2 takes a different (and safer) approach which should solve
this; it just needs me to a) document it and b) sort out the maven reporting
now I've moved to Maven 3.
----- Original Message -----
> From: "Zhangguangchao" <[email protected]>
> To: "logback users list" <[email protected]>
> Cc: "Qinyanxin" <[email protected]>
> Sent: Thursday, 21 July, 2011 8:03:57 AM
> Subject: Re: [logback-user] how to redirect system.out/err to a file?
> Hi, David,
> Thanks for your information, it helps a lot.
>
> But it seems that sysout-over-slf4j has not supported OSGi yet. And I
> can't redirect the system.out/err from various bundle which has its
> own classloader in OSGi environment. If sysout-over-slf4j works like
> log4j-over-slf4j, that will be very cool.
>
> Do you have any other advice ? Thanks.
>
> Another question is when I redirect felix-main system.out into a file,
> it casts an exception as follows:
>
> 2011-07-21 14:21:48,142 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] Exception in thread "Felix Shell TUI"
> java.lang.OutOfMemoryError: Java heap space
> 2011-07-21 14:21:48,143 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at java.util.Arrays.copyOf(Arrays.java:2882)
> 2011-07-21 14:21:48,143 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
> 2011-07-21 14:21:48,143 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
> 2011-07-21 14:21:48,143 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> java.lang.StringBuilder.append(StringBuilder.java:119)
> 2011-07-21 14:21:48,143 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> uk.org.lidalia.sysoutslf4j.context.LoggerAppenderImpl.append(LoggerAppenderImpl.java:52)
> 2011-07-21 14:21:48,144 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> uk.org.lidalia.sysoutslf4j.system.SLF4JPrintStreamDelegate.delegatePrint(SLF4JPrintStreamDelegate.java:68)
> 2011-07-21 14:21:48,144 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> uk.org.lidalia.sysoutslf4j.system.SLF4JPrintStreamImpl.print(SLF4JPrintStreamImpl.java:251)
> 2011-07-21 14:21:48,144 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:133)
> 2011-07-21 14:21:48,144 ERROR [Felix Shell TUI] java.lang.ThreadGroup
> [LogLevel.java:88] at java.lang.Thread.run(Thread.java:619)
>
> And in the log file there are lots of '>' which appears on the felix
> terminal console. It seems that '>' is printed by felix and then
> redirected to sysout-over-slf4j. However it has too many '>' and
> SLF4JPrintStreamImpl goes down. Am I right?
> Is this a bug of sysout-over-slf4j?
>
> Here is a list I use: felix 3.2.0, slf4j-api-1.6.1, logback-* -0.9.28
> and sysout-over-slf4j-1.0.2.
> Any advice?
>
>
> From: [email protected] [mailto:[email protected]]
> 代表 David Roussel
> at: 2011年7月20日 2:57
> Receiver: logback users list
> Subject: Re: [logback-user] how to redirect system.out/err to a file?
>
> Dominic,
>
> That work mentioned by rob was done, and he sent a notification to
> this this a while back.
>
> You can find all the instructions here:
> http://projects.lidalia.org.uk/sysout-over-slf4j/
>
> There are some restrictions, so do read the docs.
>
> David
>
> On 19 Jul 2011, at 07:42, Zhangguangchao wrote:
>
>
>
> Hi,
> Is there a configuration to redirect STDOUT to a file?
> By the way, I found the same question asked in
> http://www.qos.ch/pipermail/logback-user/2009-June/001141.html and I
> wanna know whether it is fixed and how. And I didn't found the new
> feature about ConsoleAppender configuration changed in Logback News.
>
> Thanks a lot.
>
> Dominic Zhang
>
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://qos.ch/mailman/listinfo/logback-user
>
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user