Skip to content

Commit

Permalink
Merge pull request #5772 from ant-media/fix-log-level
Browse files Browse the repository at this point in the history
Change nativeLogLevel to Error and call setNativeLogLevel while bean is initialized
  • Loading branch information
mekya authored Nov 22, 2023
2 parents fdb3b9d + 1d03f4a commit 430ab98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/antmedia/settings/ServerSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -394,7 +394,7 @@ else if (ILicenceService.LICENCE_TYPE_OFFLINE.equals(licenseService.getLicenseTy
offlineLicense = true;
}
}

setNativeLogLevel(nativeLogLevel);

}

Expand Down
10 changes: 6 additions & 4 deletions src/test/java/io/antmedia/test/settings/ServerSettingsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ public class ServerSettingsTest extends AbstractJUnit4SpringContextTests {

@Test
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());
Expand Down Expand Up @@ -89,6 +90,9 @@ public void testSetAppContext()

assertEquals(ServerSettings.getLocalHostAddress(), settings.getHostAddress());

String nativeLogLevel = settings.getNativeLogLevel();
Mockito.verify(settings).setNativeLogLevel(nativeLogLevel);


Mockito.doReturn("").when(settings).getHostAddressFromEnvironment();
settings.setUseGlobalIp(true);
Expand All @@ -114,9 +118,7 @@ public void testSetAppContext()
settings.setApplicationContext(applicationContext);

assertTrue(settings.isOfflineLicense());




}

@Test
Expand Down

0 comments on commit 430ab98

Please sign in to comment.