-
Notifications
You must be signed in to change notification settings - Fork 14
Debug and Trace Options
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
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
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.configwith 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)
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.
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)
See here
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
Just run with eclipse.ini (or from cmd line) with -consoleLog and the info-level logging will appear
-
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'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
shows version "0.27.0"
For Xtrace and dumps, see approach outlined here