Skip to content

Commit c7f2d3b

Browse files
authored
Fix panic when restarting the application (#306)
* Fix panic when restarting the application * update doc * typo
1 parent a9ba4d4 commit c7f2d3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

zenoh-jni/src/logger.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use crate::{errors::ZResult, throw_exception, zerror};
2323
///
2424
/// This function is meant to be called from Java/Kotlin code through JNI. It takes a `filter`
2525
/// indicating the desired log level.
26+
/// If the logger was already initialized in a previous call, then it does nothing.
2627
///
2728
/// See https://docs.rs/env_logger/latest/env_logger/index.html for accepted filter format.
2829
///
@@ -47,7 +48,8 @@ pub extern "C" fn Java_io_zenoh_Logger_00024Companion_startLogsViaJNI(
4748
.parse_filters(log_level.as_str())
4849
.tag_target_strip()
4950
.prepend_module(true)
50-
.init();
51+
.try_init()
52+
.ok();
5153
Ok(())
5254
}()
5355
.unwrap_or_else(|err| throw_exception!(env, err))

0 commit comments

Comments
 (0)