ngrok / ngrok-java

Embed ngrok secure ingress into your Java apps with a single line of code.
Other
21 stars 6 forks source link

Forward Java log configuration to Rust log subscriber #2

Closed CarlAmko closed 12 months ago

CarlAmko commented 1 year ago

Resolves https://github.com/ngrok-private/ngrok/issues/16140

What

How

Validation

Default logging configured with TRACE:

...
[Thread-1] TRACE com.ngrok.Runtime - [muxado::session] sending frame to remote
[main] TRACE com.ngrok.Runtime - [log] calling unchecked jni method: ExceptionCheck
[main] TRACE com.ngrok.Runtime - [log] looking up jni method ExceptionCheck
[main] TRACE com.ngrok.Runtime - [log] found jni method
[Thread-1] TRACE com.ngrok.Runtime - [tokio_util::codec::framed_impl] flushing framed transport
[main] TRACE com.ngrok.Runtime - [log] no exception found
[main] TRACE com.ngrok.Runtime - [log] calling checked jni method: GetMethodID
[main] TRACE com.ngrok.Runtime - [log] looking up jni method GetMethodID
[Thread-1] TRACE com.ngrok.Runtime - [tokio_util::codec::framed_impl] writing;
[main] TRACE com.ngrok.Runtime - [log] found jni method
[main] TRACE com.ngrok.Runtime - [log] checking for exception
[Thread-1] TRACE com.ngrok.Runtime - [tokio_util::codec::framed_impl] framed transport flushed
[main] TRACE com.ngrok.Runtime - [log] calling unchecked jni method: ExceptionCheck
[main] TRACE com.ngrok.Runtime - [log] looking up jni method ExceptionCheck
[Thread-1] TRACE com.ngrok.Runtime - [muxado::session] sending frame to remote
[main] TRACE com.ngrok.Runtime - [log] found jni method
[Thread-1] TRACE com.ngrok.Runtime - [tokio_util::codec::framed_impl] flushing framed transport
[Thread-1] TRACE com.ngrok.Runtime - [tokio_util::codec::framed_impl] writing;
...

Configured with DEBUG:

...
[main] DEBUG com.ngrok.Runtime - [log] add_parsable_certificates processed 1 valid and 0 invalid certs
[main] DEBUG com.ngrok.Runtime - [log] No cached session for DnsName(DnsName(DnsName("tunnel.ngrok.com")))
[main] DEBUG com.ngrok.Runtime - [log] Not resuming any session
[main] DEBUG com.ngrok.Runtime - [log] Using ciphersuite TLS13_AES_128_GCM_SHA256
[main] DEBUG com.ngrok.Runtime - [log] Not resuming
[main] DEBUG com.ngrok.Runtime - [log] TLS1.3 encrypted extensions: []
[main] DEBUG com.ngrok.Runtime - [log] ALPN protocol is None
[main] DEBUG com.ngrok.Runtime - [log] Ticket saved
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::heartbeat] sending heartbeat
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::heartbeat] waiting for response
[main] DEBUG com.ngrok.Runtime - [ngrok::internals::raw_session] decoded rpc response
[Thread-1] DEBUG com.ngrok.Runtime - [muxado::heartbeat] got response
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::stream_manager] got none from stream, trying to send a fin
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::stream_manager] removing stream and sending fin
[Thread-1] DEBUG com.ngrok.Runtime - [muxado::typed] read stream type
[main] DEBUG com.ngrok.Runtime - [ngrok::internals::raw_session] decoded rpc response
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::stream_manager] got none from stream, trying to send a fin
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::stream_manager] removing stream and sending fin
[main] DEBUG com.ngrok.Runtime - [ngrok::internals::raw_session] decoded rpc response
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::stream_manager] got none from stream, trying to send a fin
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::stream_manager] removing stream and sending fin
[Thread-1] DEBUG com.ngrok.Runtime - [ngrok::internals::raw_session] decoded rpc error response
[Thread-1] DEBUG com.ngrok.Runtime - [muxado::session] write_task exited
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::heartbeat] requester exited
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::heartbeat] heartbeat responder exiting
[Thread-3] DEBUG com.ngrok.Runtime - [muxado::heartbeat] check exited
[main] DEBUG com.ngrok.Runtime - [log] add_parsable_certificates processed 1 valid and 0 invalid certs
[main] DEBUG com.ngrok.Runtime - [log] No cached session for DnsName(DnsName(DnsName("tunnel.ngrok.com")))
[main] DEBUG com.ngrok.Runtime - [log] Not resuming any session
[main] DEBUG com.ngrok.Runtime - [log] Using ciphersuite TLS13_AES_128_GCM_SHA256
[main] DEBUG com.ngrok.Runtime - [log] Not resuming
[main] DEBUG com.ngrok.Runtime - [log] TLS1.3 encrypted extensions: []
[main] DEBUG com.ngrok.Runtime - [log] ALPN protocol is None
[main] DEBUG com.ngrok.Runtime - [log] Ticket saved
[Thread-4] DEBUG com.ngrok.Runtime - [muxado::heartbeat] sending heartbeat
[Thread-4] DEBUG com.ngrok.Runtime - [muxado::heartbeat] waiting for response
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::heartbeat] got response
[main] DEBUG com.ngrok.Runtime - [ngrok::internals::raw_session] decoded rpc response
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::stream_manager] got none from stream, trying to send a fin
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::stream_manager] removing stream and sending fin
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::typed] read stream type
[Thread-0] DEBUG com.ngrok.Runtime - [muxado::session] write_task exited
[Thread-4] DEBUG com.ngrok.Runtime - [muxado::heartbeat] heartbeat responder exiting
[Thread-2] DEBUG com.ngrok.Runtime - [muxado::heartbeat] check exited
[Thread-1] DEBUG com.ngrok.Runtime - [muxado::heartbeat] requester exited
...

Configured with INFO:

[main] INFO com.ngrok.Runtime - [session] https://38fe-73-169-116-49.ngrok.io