簡體   English   中英

強制Java / Eclipse在堆棧跟蹤中提供更多信息

[英]Force Java/Eclipse to provide more information in a stack trace

在Eclipse中調試插件時,我看到以下異常:

!ENTRY org.eclipse.ui.monitoring 2 0 2016-02-16 10:43:21.573
!MESSAGE UI freeze of 0.63s at 10:43:20.943
!SUBENTRY 1 org.eclipse.ui.monitoring 1 0 2016-02-16 10:43:21.573
!MESSAGE Sample at 10:43:21.278 (+0.335s)
Thread 'main' tid=1 (RUNNABLE)
!STACK 0
java.lang.Exception: Stack Trace
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(ZipFile.java:56)
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:686)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
    at org.eclipse.osgi.storage.bundlefile.ZipBundleEntry$ZipBundleEntryInputStream.read(ZipBundleEntry.java:156)
    at org.eclipse.osgi.storage.StorageUtil.getBytes(StorageUtil.java:195)
    at org.eclipse.osgi.storage.bundlefile.BundleEntry.getBytes(BundleEntry.java:94)`
    ...

考慮到代碼的性質以及其余的堆棧跟蹤,我懷疑Eclipse在讀取文件系統上的JAR歸檔文件時遇到了麻煩。 其中有很多,我想知道是哪一個。 但是,例外情況並未向我提供該信息。 所有這一切都發生在Eclipse和JDK代碼內(即,還沒有打我的插件。)

我可以通過某種巧妙的方法插入相關代碼,以查看它嘗試讀取哪個文件並失敗嗎? 我已經在各個位置設置了斷點。 但是,看來Eclipse使用相同的代碼來加載數百個或更多文件,因此單擊每個文件都非常繁瑣。

如果您在命令中(或在eclipse.ini中)指定-debug <path of debug file>來啟動Eclipse,則可以通過在調試文件中設置值來啟用許多調試選項。

許多核心Eclipse插件都有很長的清單,您可以打開它們。 對於日志中顯示的org.eclipse.osgi插件,選項為:

#### Debugging options for org.eclipse.osgi

# Turn on general debugging for org.eclipse.osgi
org.eclipse.osgi/debug=false
# Prints out location debug information
org.eclipse.osgi/debug/location = false
# Prints out class loading debug information
org.eclipse.osgi/debug/loader=false
# Prints out event (FrameworkEvent/BundleEvent/ServiceEvent) and listener debug information
org.eclipse.osgi/debug/events=false
# Prints out OSGi service debug information (registration/getting/ungetting etc.)
org.eclipse.osgi/debug/services=false
# Prints out bundle manifest parsing debug information
org.eclipse.osgi/debug/manifest=false
# Prints out LDAP filter debug information
org.eclipse.osgi/debug/filter=false
# Prints out security (PermissionAdmin service) debug information
org.eclipse.osgi/debug/security=false
# Prints out start level service debug information
org.eclipse.osgi/debug/startlevel=false
# Prints out package admin service debug information
org.eclipse.osgi/debug/packageadmin=false
# Prints out timing information for bundle activation
org.eclipse.osgi/debug/bundleTime=false
# Debug the loading of message bundles
org.eclipse.osgi/debug/messageBundles=false
# Debug the object pool additions
org.eclipse.osgi/debug/objectPool/adds=false
# Debug the object pool duplications
org.eclipse.osgi/debug/objectPool/dups=false
# Debug the caching of bundle headers
org.eclipse.osgi/debug/cachedmanifest = false

# Eclipse adaptor options
org.eclipse.osgi/eclipseadaptor/debug = false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin=false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver=false
org.eclipse.osgi/eclipseadaptor/converter/debug = false

### OSGi resolver options
# General debug option for the resolver. Enabling this option is equivalent to 
# enabling all other resolver debug options. 
org.eclipse.osgi/resolver = false
# Displays the current root bundle which is being resolved
org.eclipse.osgi/resolver/roots=false
# Displays information about matching capabilities returned to the resolver and
# why any were filtered out.
org.eclipse.osgi/resolver/providers = false
# Displays information about capabilities or resources that were filtered by 
# resolver hooks.
org.eclipse.osgi/resolver/hooks = false
# Displays information about uses constraint violations.
org.eclipse.osgi/resolver/uses = false
# Displays wiring information after the resolve process completes.
org.eclipse.osgi/resolver/wiring = false
# Displays the resolution report information.
org.eclipse.osgi/resolver/report = false


#### Monitoring settings

# monitor eager bundle activation
org.eclipse.osgi/monitor/activation=false
# monitor lazy bundle activation
org.eclipse.osgi/monitor/lazy=false

要啟用任何選項,您必須始終設置

org.eclipse.osgi/debug=true

然后將其他選項設置為true

Eclipse的最新發行版還在“首選項”中提供了“常規>跟蹤”頁面來設置這些值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM