File tree Expand file tree Collapse file tree 2 files changed +13
-17
lines changed
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap
internal-api/src/main/java/datadog/trace/api Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Original file line number Diff line number Diff line change 41
41
import datadog .trace .bootstrap .instrumentation .jfr .InstrumentationBasedProfiling ;
42
42
import datadog .trace .util .AgentTaskScheduler ;
43
43
import datadog .trace .util .AgentThreadFactory .AgentThread ;
44
+ import datadog .trace .util .SystemUtils ;
44
45
import datadog .trace .util .throwable .FatalAgentMisconfigurationError ;
45
46
import java .lang .instrument .Instrumentation ;
46
47
import java .lang .reflect .InvocationTargetException ;
@@ -370,6 +371,18 @@ public void run() {
370
371
StaticEventLogger .end ("Profiling" );
371
372
}
372
373
374
+ // log eventual errors that would have happened before we could log them
375
+ if (SystemUtils .hasEnvError ) {
376
+ log .warn (
377
+ "The Java Security Manager prevented the Datadog Tracer from accessing at least one environment variable. "
378
+ + "Consider granting AllPermission to the dd-java-agent jar." );
379
+ }
380
+ if (SystemUtils .hasPropertyError ) {
381
+ log .warn (
382
+ "The Java Security Manager prevented the Datadog Tracer from accessing at least one system property. "
383
+ + "Consider granting AllPermission to the dd-java-agent jar." );
384
+ }
385
+
373
386
StaticEventLogger .end ("Agent.start" );
374
387
}
375
388
Original file line number Diff line number Diff line change @@ -4025,24 +4025,7 @@ private static String getProp(String name, String def) {
4025
4025
: ConfigProvider .getInstance (),
4026
4026
InstrumenterConfig .get ());
4027
4027
4028
- private static boolean configErrorsLogged = false ;
4029
-
4030
4028
public static Config get () {
4031
- // checking if there are errors that we couldn't log earlier to report
4032
- if (!configErrorsLogged && (SystemUtils .hasEnvError || SystemUtils .hasPropertyError )) {
4033
- // we want to log once, but if 2 threads end up here it's not a big issue.
4034
- configErrorsLogged = true ;
4035
- if (SystemUtils .hasEnvError ) {
4036
- log .warn (
4037
- "The Java Security Manager prevented the Datadog Tracer from accessing at least one environment variable. "
4038
- + "Consider granting AllPermission to the dd-java-agent jar." );
4039
- }
4040
- if (SystemUtils .hasPropertyError ) {
4041
- log .warn (
4042
- "The Java Security Manager prevented the Datadog Tracer from accessing at least one system property. "
4043
- + "Consider granting AllPermission to the dd-java-agent jar." );
4044
- }
4045
- }
4046
4029
return INSTANCE ;
4047
4030
}
4048
4031
You can’t perform that action at this time.
0 commit comments