My Oracle Support Banner

Log4J应用 线程被锁在 org.apache.log4j.spi.RootLogger (Doc ID 2259771.1)

Last updated on JUNE 20, 2018

适用于:

Oracle WebLogic Server - 版本 10.3 和更高版本
本文档所含信息适用于所有平台

症状

引用Log4j的应用在weblogic server上运行,繁忙时会出现性能问题,从控制台或thread dump中能看到很多thread进入BLOCKED状态。

Thread dump 出现如下情况


"Thread-299" #309 prio=5 os_prio=0 tid=0x00007fa2983ff800 nid=0x68eb waiting for monitor entry [0x00007fa260e58000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
- waiting to lock <0x00000000e3e88830> (a org.apache.log4j.spi.RootLogger) <----------------------------
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)
at com.oracle.adam.log4j.test.tasks.Task.run(Task.java:34)
at java.lang.Thread.run(Thread.java:745)

Locked ownable synchronizers:
- None

"Thread-298" #308 prio=5 os_prio=0 tid=0x00007fa298516800 nid=0x68ea waiting for monitor entry [0x00007fa260f59000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
- waiting to lock <0x00000000e3e88830> (a org.apache.log4j.spi.RootLogger) <----------------------------
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)
at com.oracle.adam.log4j.test.tasks.Task.run(Task.java:34)
at java.lang.Thread.run(Thread.java:745)

Locked ownable synchronizers:
- None
....................... similar blocked thread totally 40

"Thread-280" #290 prio=5 os_prio=0 tid=0x00007fa29853b000 nid=0x68d8 runnable [0x00007fa27925c000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:315)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
- locked <0x00000000e3ea8ab8> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(PrintStream.java:480)
- locked <0x00000000e3ea8a98> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
- locked <0x00000000e3ea8a80> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:59)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:324)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
- locked <0x00000000e3e8f0e8> (a org.apache.log4j.ConsoleAppender)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
- locked <0x00000000e3e88830> (a org.apache.log4j.spi.RootLogger) <---------------------
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)
at com.oracle.adam.log4j.test.tasks.Task.run(Task.java:38)
at java.lang.Thread.run(Thread.java:745)

Locked ownable synchronizers:
- None

 

更改

 

原因

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


文档内容
症状
更改
原因
解决方案

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.