File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
dd-java-agent/agent-crashtracking/src/main/java/com/datadog/crashtracking Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -131,8 +131,9 @@ private static void initializeCrashUploader(HotSpotDiagnosticMXBean diagBean) {
131131 String onErrorFile = diagBean .getVMOption ("ErrorFile" ).getValue ();
132132 CrashUploaderScriptInitializer .initialize (onErrorVal , onErrorFile );
133133 } catch (Throwable t ) {
134- LOG .warn (
135- "Failed creating custom crash upload script. Crash tracking will not work properly." , t );
134+ logInitializationError (
135+ "Unexpected exception while creating custom crash upload script. Crash tracking will not work properly." ,
136+ t );
136137 }
137138 }
138139
@@ -141,7 +142,19 @@ private static void initializeOOMENotifier(HotSpotDiagnosticMXBean diagBean) {
141142 String onOutOfMemoryVal = diagBean .getVMOption ("OnOutOfMemoryError" ).getValue ();
142143 OOMENotifierScriptInitializer .initialize (onOutOfMemoryVal );
143144 } catch (Throwable t ) {
144- LOG .warn ("Failed initializing OOME notifier. OOMEs will not be tracked." , t );
145+ logInitializationError (
146+ "Unexpected exception while initializing OOME notifier. OOMEs will not be tracked." , t );
147+ }
148+ }
149+
150+ private static void logInitializationError (String msg , Throwable t ) {
151+ if (LOG .isDebugEnabled ()) {
152+ LOG .warn ("{}" , msg , t );
153+ } else {
154+ LOG .warn (
155+ "{} [{}] (Change the logging level to debug to see the full stacktrace)" ,
156+ msg ,
157+ t .getMessage ());
145158 }
146159 }
147160}
You can’t perform that action at this time.
0 commit comments