Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Issue when Connection string configured at runtime

Open
#2,952 7 comments 0 reactions 1 assignee View on GitHub

@heyams is already working on this.

Since Mar 9, 2023.

Assessment

This issue has not been assessed yet.

Description

Needs: Attention :wave:

Hey guys, i have an application in java 11, application insights jar 3.4.8 and pom core-version 3.4.10 and trying this configuration:

image

The idea is to turn on/off the application insights logging in runtime.
When i tested it and set the key false means that i will set an empty key ConnectionString.configure("");
and logs will not sent to application insights. That worked fine.
When i change de key set to true with my real connection string, now my requests will send to application insights. That worked aswell.

image

Ok. But now when i back the configuration false and reconfigure de connection String to an empty string, the logs keep sending to application insights and i get the warning that connection is already set:

image

Everytime i do a request i create a new telemetry client like this and tried to flush but still cant override the previous connection string configuration:

image

Looks like i can only change de connection if i rebuild the application every request to changes take effect.
Is there another way to implement this idea? Turn on/off the aplication insights injestion while in runtime application?

Dominant language
Java
Stars
327
Forks
222
Avg merge
22h 34m
Merged PRs (30d)
14

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/ApplicationInsights-Java

All issues in microsoft/ApplicationInsights-Java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.