Debug and Trace Options - OpenLiberty/liberty-tools-eclipse GitHub Wiki
Trace
Make a 'debug.opts' file like below and run with:
PATH="$PATH:C:\mvn\bin:C:\gradle7\gradle-7.4.2-bin\gradle-7.4.2\bin" mvn clean install -Dosgi.debug="C:/wdt2/debug.opts" -Dtycho.showEclipseLog
debug.opts
io.openliberty.tools.eclipse/trace/utils=true
io.openliberty.tools.eclipse/debug=true
io.openliberty.tools.eclipse/trace/tools=true
io.openliberty.tools.eclipse/trace/handlers=true
io.openliberty.tools.eclipse/trace/ui=true
For an end-user install
The eclipse.ini could look like:
-debug
C:/wdt2/debug.opts
Attaching Debugger to Maven while running from Liberty Tools Eclipse (since the user can't run 'mvnDebug')
- Create a file in the project app root named
.mvn/jvm.config
with contents:-Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000
(or use suspend=n if that's more convenient)
(not sure what version of Maven adds this support...just look in the 'mvn' script to see if this is read)
Language Server Debug
Debugger
To debug all the language servers, start the hosting Eclipse with JVM sysprop like this (set in Arguments tab under VM Arguments):
-Dio.openliberty.tools.eclipse.mpls.LibertyMPLSConnection.debugPort=8000
-Dorg.eclipse.wildwebdeveloper.xml.internal.XMLLanguageServer.debugPort=8001
-Dio.openliberty.tools.eclipse.liberty.languageserver.LibertyLSConnection.debugPort=8002
-Dio.openliberty.tools.eclipse.jakarta.languageserver.JakartaLSConnection.debugPort=8003
You can narrow this down to a subset if you'd like it to be less disruptive.
Suspend
By default the JVM will launch but not be suspended, when the debug port is set.
To start the JVM in a suspended state while the debugger is attached, use, e.g:
-Dio.openliberty.tools.eclipse.mpls.LibertyMPLSConnection.debugSuspend=y
(use the corresponding property for each LS based on the classnames above)
Reference
See here
Debugging end-user install
Like any Java process, you can include this at some point after the -vmargs:
-vmargs
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999
LSP Debug
LCLS bootstrap.properties, server.env
Just run with eclipse.ini (or from cmd line) with -consoleLog
and the info-level logging will appear
LCLS server.xml (XML, Lemminx, etc.)
-
Preferences -> Language Servers -> Logs Select "LemMinX", Log to File (and console if desired)
-
Logging for LCLS extension
Add this into eclipse.ini
-Dorg.eclipse.wildwebdeveloper.xml.internal.XMLLanguageServer.log.level=INFO
and it will log to: ${workspace}/.metadata/lemminx.log
(not in a format we're especially used to in WAS/Liberty but there it is)
WARNING: - If I ran the XML LS in debug mode and failed to attach the debugger in time, it seemed it messed up logging for the lifetime of the JVM.
- Run eclipse with
LEMMINX_DEBUG=true ... eclipse.exe ... 2>&1 | tee consoleLog.txt
Lemminx version discovery
Lemminx's XML server is started as a separate process, so it's not included as its own plugin. This process is launched by the Wild Web Developer (WWD) XML plugin.
To understand the version of Lemminx:
- Identify the version of WWD XML (via Help->About Eclipse IDE)
- Unzip the corresponding WWD XML plugin jar
jar xf ~.p2\pool\plugins\org.eclipse.wildwebdeveloper.xml_1.0.2.202301201156.jar
- In the unzipped contents, find the lemminx uber jar and unzip it
jar xf language-servers/server/org.eclipse.lemminx-uber.jar
- Look at the included lemminx pom.properties:
cat META-INF\maven\org.eclipse.lemminx\org.eclipse.lemminx\pom.properties
Platform Date | Lemminx Version | LTE targeted (or working) version(s) |
---|---|---|
2023-03 | version 0.23.0 | 23.0.6, 23.0.7 |
2023-06 | version 0.25.0 | 23.0.9 |
2023-09 | version 0.27.0 | 23.0.12 |
2023-12 | version 0.27.0 | 23.0.12, 24.0.3 |
FURTHER INFO
For Xtrace and dumps, see approach outlined here