Search in sources :

Example 1 with Logger

use of com.newrelic.api.agent.Logger in project newrelic-java-agent by newrelic.

the class SolrMetricReporter_Instrumentation method init.

public void init(PluginInfo pluginInfo) {
    Weaver.callOriginal();
    Logger logger = NewRelic.getAgent().getLogger();
    if (SolrJmxReporter.class.isInstance(this)) {
        Object thisTemp = this;
        SolrJmxReporter solrJMX = (SolrJmxReporter) thisTemp;
        MBeanServer mBeanServer = solrJMX.getMBeanServer();
        logger.log(Level.FINEST, "SolrJmxReporter mBeanServer: {0}", mBeanServer);
        if (mBeanServer != null) {
            AgentBridge.privateApi.addMBeanServer(mBeanServer);
            logger.log(Level.FINEST, "added mBeanServer: {0}", mBeanServer);
        }
    }
}
Also used : Logger(com.newrelic.api.agent.Logger) SolrJmxReporter(org.apache.solr.metrics.reporters.SolrJmxReporter) MBeanServer(javax.management.MBeanServer)

Example 2 with Logger

use of com.newrelic.api.agent.Logger in project newrelic-java-agent by newrelic.

the class LinkingMetadata method readLinkingMetadata.

@Override
public Map<String, String> readLinkingMetadata() {
    Agent agent = NewRelic.getAgent();
    Logger logger = agent.getLogger();
    logger.log(Level.INFO, "JMX LinkingMetadata: Fetching linking metadata from the agent...");
    return agent.getLinkingMetadata();
}
Also used : Agent(com.newrelic.api.agent.Agent) Logger(com.newrelic.api.agent.Logger)

Example 3 with Logger

use of com.newrelic.api.agent.Logger in project newrelic-java-agent by newrelic.

the class URLAnalyzerTest method testRunProcesses.

@Test
public void testRunProcesses() throws Exception {
    JarData jarData = new JarData("foo", new JarInfo("1.2.3", Collections.<String, String>emptyMap()));
    URL url = URI.create("https://example.com").toURL();
    Logger logger = mock(Logger.class);
    Function<URL, JarData> processor = mock(Function.class);
    Consumer<JarData> consumer = mock(Consumer.class);
    when(processor.apply(url)).thenReturn(jarData);
    URLAnalyzer testClass = new URLAnalyzer(url, processor, consumer, logger);
    testClass.run();
    verify(consumer).accept(jarData);
}
Also used : Logger(com.newrelic.api.agent.Logger) URL(java.net.URL) Test(org.junit.Test)

Example 4 with Logger

use of com.newrelic.api.agent.Logger in project newrelic-java-agent by newrelic.

the class URLAnalyzerTest method testProcessingSkipsNull.

@Test
public void testProcessingSkipsNull() throws Exception {
    URL url = URI.create("https://example.com").toURL();
    Logger logger = mock(Logger.class);
    Function<URL, JarData> processor = mock(Function.class);
    Consumer<JarData> consumer = mock(Consumer.class);
    when(processor.apply(url)).thenReturn(null);
    URLAnalyzer testClass = new URLAnalyzer(url, processor, consumer, logger);
    testClass.run();
    verifyNoMoreInteractions(consumer);
}
Also used : Logger(com.newrelic.api.agent.Logger) URL(java.net.URL) Test(org.junit.Test)

Example 5 with Logger

use of com.newrelic.api.agent.Logger in project newrelic-java-agent by newrelic.

the class LinkingMetadataRegistrationTest method setup.

@Before
public void setup() throws Exception {
    name = new ObjectName(MBEAN_NAME);
    logger = mock(Logger.class);
    fakeServer = mock(MBeanServer.class);
}
Also used : Logger(com.newrelic.api.agent.Logger) ObjectName(javax.management.ObjectName) MBeanServer(javax.management.MBeanServer) Before(org.junit.Before)

Aggregations

Logger (com.newrelic.api.agent.Logger)7 URL (java.net.URL)3 Test (org.junit.Test)3 MBeanServer (javax.management.MBeanServer)2 InfiniteTracing (com.newrelic.InfiniteTracing)1 AgentConnectionEstablishedListener (com.newrelic.agent.AgentConnectionEstablishedListener)1 ExpirationService (com.newrelic.agent.ExpirationService)1 GCService (com.newrelic.agent.GCService)1 HarvestServiceImpl (com.newrelic.agent.HarvestServiceImpl)1 RPMServiceManagerImpl (com.newrelic.agent.RPMServiceManagerImpl)1 ThreadService (com.newrelic.agent.ThreadService)1 TracerService (com.newrelic.agent.TracerService)1 TransactionService (com.newrelic.agent.TransactionService)1 AttributesService (com.newrelic.agent.attributes.AttributesService)1 Agent (com.newrelic.agent.bridge.Agent)1 BrowserServiceImpl (com.newrelic.agent.browser.BrowserServiceImpl)1 CacheService (com.newrelic.agent.cache.CacheService)1 CircuitBreakerService (com.newrelic.agent.circuitbreaker.CircuitBreakerService)1 CommandParser (com.newrelic.agent.commands.CommandParser)1 AgentConfig (com.newrelic.agent.config.AgentConfig)1