From 98f9cab7089ea8b292f0917f825744bd4da2edb4 Mon Sep 17 00:00:00 2001 From: USAMAWIZARD Date: Fri, 3 Nov 2023 00:53:03 +0530 Subject: [PATCH 1/4] set native log level to ERROR --- src/main/java/io/antmedia/settings/ServerSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/antmedia/settings/ServerSettings.java b/src/main/java/io/antmedia/settings/ServerSettings.java index b7bdbae36..320ad0290 100755 --- a/src/main/java/io/antmedia/settings/ServerSettings.java +++ b/src/main/java/io/antmedia/settings/ServerSettings.java @@ -148,7 +148,7 @@ public class ServerSettings implements ApplicationContextAware { * Native Log Level is used for ffmpeg and WebRTC logs */ @Value( "${"+SETTINGS_NATIVE_LOG_LEVEL+":'ERROR'}" ) - private String nativeLogLevel = LOG_LEVEL_WARN; + private String nativeLogLevel = LOG_LEVEL_ERROR; /** * Enable heart beat for Ant Media Server @@ -394,7 +394,7 @@ else if (ILicenceService.LICENCE_TYPE_OFFLINE.equals(licenseService.getLicenseTy offlineLicense = true; } } - + setNativeLogLevel(LOG_LEVEL_ERROR); } From 6e090df67cce1c923f5ad3d129e12b03389b0f85 Mon Sep 17 00:00:00 2001 From: USAMAWIZARD Date: Fri, 3 Nov 2023 01:30:51 +0530 Subject: [PATCH 2/4] fix test case --- src/test/java/io/antmedia/test/settings/ServerSettingsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java index f0fb50b66..9c819b906 100644 --- a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java +++ b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java @@ -32,7 +32,7 @@ public void testNativeLogLevel() { ServerSettings settings = new ServerSettings(); assertEquals(Logging.Severity.LS_WARNING, settings.getWebRTCLogLevel()); - assertEquals(ServerSettings.LOG_LEVEL_WARN, settings.getNativeLogLevel()); + assertEquals(ServerSettings.LOG_LEVEL_ERROR, settings.getNativeLogLevel()); settings.setNativeLogLevel(ServerSettings.LOG_LEVEL_ALL); assertEquals(Logging.Severity.LS_VERBOSE, settings.getWebRTCLogLevel()); From d4aa181058bdc0230ec041bb72675ff9d236b301 Mon Sep 17 00:00:00 2001 From: mekya Date: Wed, 22 Nov 2023 08:38:29 +0300 Subject: [PATCH 3/4] Check if setNativeLogLevel is called in setApplicationContext --- src/main/java/io/antmedia/settings/ServerSettings.java | 2 +- .../java/io/antmedia/test/settings/ServerSettingsTest.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/antmedia/settings/ServerSettings.java b/src/main/java/io/antmedia/settings/ServerSettings.java index 320ad0290..9cbafe335 100755 --- a/src/main/java/io/antmedia/settings/ServerSettings.java +++ b/src/main/java/io/antmedia/settings/ServerSettings.java @@ -394,7 +394,7 @@ else if (ILicenceService.LICENCE_TYPE_OFFLINE.equals(licenseService.getLicenseTy offlineLicense = true; } } - setNativeLogLevel(LOG_LEVEL_ERROR); + setNativeLogLevel(nativeLogLevel); } diff --git a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java index 9c819b906..0c2c695aa 100644 --- a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java +++ b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java @@ -29,6 +29,7 @@ public class ServerSettingsTest extends AbstractJUnit4SpringContextTests { @Test public void testNativeLogLevel() { + ServerSettings settings = new ServerSettings(); assertEquals(Logging.Severity.LS_WARNING, settings.getWebRTCLogLevel()); @@ -89,6 +90,8 @@ public void testSetAppContext() assertEquals(ServerSettings.getLocalHostAddress(), settings.getHostAddress()); + Mockito.verify(settings).setNativeLogLevel(settings.getNativeLogLevel()); + Mockito.doReturn("").when(settings).getHostAddressFromEnvironment(); settings.setUseGlobalIp(true); @@ -114,9 +117,7 @@ public void testSetAppContext() settings.setApplicationContext(applicationContext); assertTrue(settings.isOfflineLicense()); - - - + } @Test From 1d03f4ac1ebd2a14ccf92f77b4b6ec317b8838f7 Mon Sep 17 00:00:00 2001 From: mekya Date: Wed, 22 Nov 2023 09:57:37 +0300 Subject: [PATCH 4/4] Fix the failing test case --- .../java/io/antmedia/test/settings/ServerSettingsTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java index 0c2c695aa..af8ce003a 100644 --- a/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java +++ b/src/test/java/io/antmedia/test/settings/ServerSettingsTest.java @@ -90,7 +90,8 @@ public void testSetAppContext() assertEquals(ServerSettings.getLocalHostAddress(), settings.getHostAddress()); - Mockito.verify(settings).setNativeLogLevel(settings.getNativeLogLevel()); + String nativeLogLevel = settings.getNativeLogLevel(); + Mockito.verify(settings).setNativeLogLevel(nativeLogLevel); Mockito.doReturn("").when(settings).getHostAddressFromEnvironment();