Capturing from programs started via script (most servers)
FollowTo capture the execution of a program to BugJail, the only thing you need to do is start Java Virtual Machine with one additional option.
This article links to two alternative ways how to construct the BugJail Agent option string and then shows how to use the option to enable BugJail capturing from programs that are started via script (such as most servers).
Step 1: Construct BugJail Agent option & copy to clipboard
Alternative A: construct BugJail Agent option string by using Capturing Assistant (easy user-interface, but supports only the two most common configuration options currently).
Alternative B: construct BugJail Agent option string manually (more effort, but allows using additional options).
Step 2: Set the BugJail Agent option to JAVA_OPTS environment variable
If using Windows PowerShell
- Open Windows PowerShell
- Execute the command below, where <bugjail_agent_option> is the BugJail Agent option string that was constructed in the previous step and copied to clipboard
$env:JAVA_OPTS = "<bugjail_agent_option>"
Example - Setting environment variable that enables BugJail capturing on Windows
$env:JAVA_OPTS = "-javaagent:C:\Users\Henri\.BugJail\agent.jar"
If using Mac or Linux
- Open MacOS Terminal or Linux shell
- Execute the command below, where <bugjail_agent_option> is the BugJail Agent option string that was constructed in the previous step and copied to clipboard
export JAVA_OPTS="<bugjail_agent_option>"
Example - Setting environment variable that enables BugJail capturing on Mac or Linux
export JAVA_OPTS="-javaagent:/home/henri/.BugJail/agent.jar"
Step 3: Execute the script that starts JVM (without any changes)
Most server startup scripts detect the presence of JAVA_OPTS environment variable and pass its value to JVM, so whatever you are starting, you can start it just as usual and BugJail capturing should work due to the environment variable.
Step 4: Verify that capturing worked
- In the shell's standard output, you should see extra logging from BugJail Agent
- In BugJail, the "Welcome to BugJail" or "Capturing Assistant" -dialog should disappear within 1-2 seconds, if it was visible, revealing a list of captures.
- In BugJail "Captures" -panel, you should see a new capture row within 1-2 seconds.
Appendix: Common servers that work this way
- Tomcat
- Geronimo
- TODO add more comprehensive list
Comments
0 comments
Please sign in to leave a comment.