Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading ApplicationInsights.xml from current directory #265

Closed
symm opened this issue Sep 7, 2015 · 6 comments
Closed

Loading ApplicationInsights.xml from current directory #265

symm opened this issue Sep 7, 2015 · 6 comments

Comments

@symm
Copy link
Contributor

symm commented Sep 7, 2015

In the ConfigurationFileLocator there is an option to load configuration from the executing jar directory

I've got an application packaged as a jar and ApplicationInsights.xml configuration in the same directory

squash ➜ ls -1
ApplicationInsights.xml
raf.jar

When I run my application it fails to read the configuration from ApplicationInsights.xml

java -jar raf.jar

AI: INFO 07-09-2015 12:08, 14: Successfully registered the filter 'ApplicationInsightsWebFilter'
AI: INFO 07-09-2015 12:08, 14: Configuration file 'ApplicationInsights.xml' was NOT found by default class loader
AI: ERROR 07-09-2015 12:08, 14: Failed to initialize configuration, exception: null

Is there a way to externalise the config? I can't package the config xml in the jar as a resource because it varies depending on the environment the app runs in.

@gupele
Copy link
Contributor

gupele commented Sep 7, 2015

Hi,
Thank you for your input.
What version are you currently using?

@gupele
Copy link
Contributor

gupele commented Sep 7, 2015

It might be that your ApplicationInsights.xml is not well formed, could you please check that? please make sure that there are no 'bad' chars at the beginning of the file

@symm
Copy link
Contributor Author

symm commented Sep 7, 2015

Hi @gupele, I'm using com.microsoft.azure:applicationinsights-web:1.0.1') with the following xml:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
  <SDKLogger />

  <!-- The key from the portal: -->

  <InstrumentationKey>{redacted}</InstrumentationKey>


  <!-- HTTP request component (not required for bare API) -->

  <TelemetryModules>
    <Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/>
  </TelemetryModules>

  <!-- Events correlation (not required for bare API) -->
  <!-- These initializers add context data to each event -->

  <TelemetryInitializers>
    <Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/>
    <Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/>

  </TelemetryInitializers>
</ApplicationInsights>

@gupele
Copy link
Contributor

gupele commented Sep 8, 2015

Thanks
The conf file seems to be fine.
I think we've found the issue, a new version 1.0.2 that includes the fix, is expected to be released in the next few days

@symm
Copy link
Contributor Author

symm commented Sep 8, 2015

Nice one, thanks @gupele!

@gupele gupele closed this as completed Feb 17, 2016
@watsonVon
Copy link

Is this fixed ? right now i have the same Problem with almost the exact configuration of @symm.

I am using this Lib:

// MS Azure Application Insights logging
compile 'com.microsoft.azure:applicationinsights-logging-logback:1.0.4'

My ApplicationInsights.xml file is not found.

Failed to find configuration file, exception while fetching from library location: 'null'

@ghost ghost locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants