Wiki Markup |
---|
{scrollbar} |
Anchor | ||||
---|---|---|---|---|
|
5.1. Troubleshooting, Debugging, Profiling, and
...
Monitoring
Troubleshooting
Logging
Logging is easy to control through the console, with commands grouped under log shell. To learn about the available logging commands type:
...
- Use
log:set
to dynamically change the global log level - Execute the problematic operation
- Use
log:display
(orlog:display-exception
to display the log
Worst Case Scenario
If you end up with a Karaf in a really bad state (i.e. you can not boot it anymore) or you just want to revert to a clean state quickly, you can safely remove the data
directory just in the installation directory. This folder contains transient data and will be recreated if you remove it and relaunch Karaf.
You may also want to remove the files in the deploy
folder to avoid them being automatically installed when Karaf is started the first time.
Debugging
Usually, the easiest way to debug Karaf or any application deployed onto it is to use remote debugging.
Remote debugging can be easily activated by setting the KARAF_DEBUG
environment variable to TRUE
.
...
Code Block |
---|
set DEFAULT_JAVA_DEBUG_OPTS='-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005' |
Profiling
YourKit
You need a few steps to be able to profile Karaf using YourKit.
The first one is to edit the etc/config.properties
configuration file and add the following property:
...
Run Karaf from the console, and you should now be able to connect using YourKit standalone or from your favorite IDE.
Monitoring
Karaf uses JMX for monitoring and management of all Karaf components.
The JMX connection could be:
- local using the process id
- remote using the
rmiRegistryPort
property defined inetc/org.apache.karaf.management.cfg
file.
Using JMX, you can have a clean overview of the running Karaf instance:
- A overview with graphics displaying the load in terms of thread, heap/GC, etc:
- A thread overview:
- A memory heap consumption, including "Perform GC" button:
- A complete JVM summary, with all number of threads, etc:
You can manage Karaf features like you are in the shell. For example, you have access to the Admin service MBean, allowing you to create, rename, destroy, change SSH port, etc Karaf instances:
You can also manage Karaf features MBean to list, install, uninstall Karaf features:
Wiki Markup |
---|
{scrollbar} |