Dynamically attaching to logging agents of an application

Users can automatically discover and attach to logging agents of an application via the profile launch configuration. The logging agent discoverer is used to perform periodic queries on the logging agents that are registered by the process launched. If the discoverer finds a log agent registered by the process, then it will automatically attach and monitor the agent. Users can also define filters so that only a subset of the registered agents is attached.

The steps below describe how an application's logging agents can dynamically be discovered. The following instructions use the JSR-047 Logging Sample but the steps can easily be applied to any other application type:

  1. Create the JSR-047 Logging Sample under File > New > Example > Logging. This sample requires the bin directory of the Agent Controller to be on the system's path.
  2. From the Profiling and Logging Perspective, click on the Profile profiling icon drop-down menu, and select Profile... The Profile wizard opens.
  3. Create a new launch configuration of type Java Application. Learn more about profiling launch configurations in Preparing to launch an agent.
  4. Point the project name and the main class to the sample project name and class.
  5. Switch to the Monitor tab and select Logging Agent Discoverer.
  6. You can define a filter on the logging agents that are discovered or adjust the query frequency period by clicking Edit Option.
  7. Click on Profile.

Under the profiling monitor view, there should initially be one agent called Logging Agent Discoverer. A second agent called HyadesLoggingJava14Sample should appear shortly. The second agent is the logging agent that is registered by the application. Double clicking the HyadesLoggingJava14Sample agent will reveal its logged messages.



Related concepts
Log and Trace Analyzer views
Log file correlation

Related tasks
Analyzing log files
Preparing to launch an agent
Working with the JSR-047 Logging sample