2012-09-25 14 views
5

これは、stackoverflowサイト上の実際のstackoverflow例外です!私はちょうど誰かが以前にそれを見ていたかどうか、そして彼らがそれに対処するために使用したものを疑問に思ったlog4j stackoverflow

java.lang.StackOverflowError 
at java.lang.Exception.<init>(Exception.java:41) 
at java.io.IOException.<init>(IOException.java:41) 
at java.io.FileOutputStream.writeBytes(Native Method) 
at java.io.FileOutputStream.write(FileOutputStream.java:260) 
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263) 
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106) 
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116) 
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203) 
at java.io.Writer.write(Writer.java:140) 
at org.apache.log4j.helpers.CountingQuietWriter.write(CountingQuietWriter.java:44) 
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) 
at org.apache.log4j.contribs.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:395) 
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) 
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) 
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) 
at org.apache.log4j.Category.callAppenders(Category.java:203) 
at org.apache.log4j.Category.forcedLog(Category.java:388) 
at org.apache.log4j.Category.log(Category.java:835) 
at org.apache.log4j.contribs.LoggingOutputStream.flush(LoggingOutputStream.java:168) 
at java.io.PrintStream.write(PrintStream.java:432) 
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) 
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85) 
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168) 
at java.io.PrintStream.write(PrintStream.java:477) 
at java.io.PrintStream.print(PrintStream.java:619) 
at java.io.PrintStream.println(PrintStream.java:756) 
at org.apache.log4j.helpers.LogLog.error(LogLog.java:142) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:77) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:67) 
at org.apache.log4j.helpers.CountingQuietWriter.write(CountingQuietWriter.java:48) 
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) 
at org.apache.log4j.contribs.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:395) 
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) 
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) 
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) 
at org.apache.log4j.Category.callAppenders(Category.java:203) 
at org.apache.log4j.Category.forcedLog(Category.java:388) 
at org.apache.log4j.Category.log(Category.java:835) 
at org.apache.log4j.contribs.LoggingOutputStream.flush(LoggingOutputStream.java:168) 
at java.io.PrintStream.write(PrintStream.java:432) 
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) 
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85) 
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168) 
at java.io.PrintStream.write(PrintStream.java:477) 
at java.io.PrintStream.print(PrintStream.java:619) 
at java.io.PrintStream.println(PrintStream.java:756) 
at org.apache.log4j.helpers.LogLog.error(LogLog.java:142) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:77) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:67) 
at org.apache.log4j.helpers.CountingQuietWriter.write(CountingQuietWriter.java:48) 
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) 
at org.apache.log4j.contribs.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:395) 
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) 
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) 
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) 
at org.apache.log4j.Category.callAppenders(Category.java:203) 
at org.apache.log4j.Category.forcedLog(Category.java:388) 
at org.apache.log4j.Category.log(Category.java:835) 
at org.apache.log4j.contribs.LoggingOutputStream.flush(LoggingOutputStream.java:168) 
at java.io.PrintStream.write(PrintStream.java:432) 
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) 
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85) 
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168) 
at java.io.PrintStream.write(PrintStream.java:477) 

...(繰り返しの約10倍)

at java.io.PrintStream.write(PrintStream.java:432) 
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) 
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85) 
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168) 
at java.io.PrintStream.write(PrintStream.java:477) 
at java.io.PrintStream.print(PrintStream.java:619) 
at java.io.PrintStream.println(PrintStream.java:756) 
at org.apache.log4j.helpers.LogLog.error(LogLog.java:142) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:77) 
at org.apache.log4j.helpers.OnlyOnceErrorHandler.error(OnlyOnceErrorHandler.java:67) 
at org.apache.log4j.helpers.CountingQuietWriter.write(CountingQuietWriter.java:48) 
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) 
at org.apache.log4j.contribs.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:395) 
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) 
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) 
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) 

java.lang.StackOverflowErrorを

+0

どのような種類のlog4j構成を使用していますか? – DNA

答えて

5

ここにあなたのlog4j設定ファイルとコードがありません。このようSystem.errを交換

しかし

1)LoggingOutputStreamコードのどこかで使用されていること初期推定は、:

System.setErr(new PrintStream(new LoggingOutputStream(Category.getRoot(), Priority.WARN), true)); 

2)log4jは適切に設定され、System.errに内部エラーを印刷しようとしていませんLogLogにあります。

これは、スタックオーバーフローを引き起こす循環ログ呼び出しを作成します。

1)からSystem.errインターセプターを削除してみます。これにより、2)の内部エラーが発生する可能性があります。

+1

多くのことがあります。あなたは私たちの問題を解決しました:-) – RubioRic