You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2022/07/19 03:42:14 UTC
[incubator-tuweni] branch main updated: expose more logging and set up sane logging when using the client
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/main by this push:
new 968b6497 expose more logging and set up sane logging when using the client
new 1c6e2e84 Merge pull request #427 from atoulme/more_logging
968b6497 is described below
commit 968b649747c97ee5c62f6c5d22d8d0b3bb6670a0
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Sat Jul 16 10:02:27 2022 -0700
expose more logging and set up sane logging when using the client
---
.../ethclient/WireConnectionPeerRepositoryAdapter.kt | 11 ++++++++++-
eth-client/src/main/resources/logback.xml | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/WireConnectionPeerRepositoryAdapter.kt b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/WireConnectionPeerRepositoryAdapter.kt
index ccb01123..442ba776 100644
--- a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/WireConnectionPeerRepositoryAdapter.kt
+++ b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/WireConnectionPeerRepositoryAdapter.kt
@@ -21,6 +21,7 @@ import org.apache.tuweni.peer.repository.Identity
import org.apache.tuweni.rlpx.WireConnectionRepository
import org.apache.tuweni.rlpx.wire.SubProtocolIdentifier
import org.apache.tuweni.rlpx.wire.WireConnection
+import org.slf4j.LoggerFactory
import java.time.Instant
import java.util.concurrent.ConcurrentHashMap
@@ -29,6 +30,10 @@ import java.util.concurrent.ConcurrentHashMap
*/
class WireConnectionPeerRepositoryAdapter(val peerRepository: EthereumPeerRepository) : WireConnectionRepository {
+ companion object {
+ val logger = LoggerFactory.getLogger(WireConnectionPeerRepositoryAdapter::class.java)
+ }
+
private val wireConnectionToIdentities = ConcurrentHashMap<String, Identity>()
private val connections = ConcurrentHashMap<String, WireConnection>()
private val connectionListeners = ArrayList<WireConnectionRepository.Listener>()
@@ -79,7 +84,11 @@ class WireConnectionPeerRepositoryAdapter(val peerRepository: EthereumPeerReposi
}
fun get(ethereumConnection: EthereumConnection): WireConnection {
- val conn = connections[ethereumConnection.identity().id()] ?: throw NoSuchElementException("No connection available")
+ val conn = connections[ethereumConnection.identity().id()]
+ if (conn == null) {
+ logger.info("Connection ${ethereumConnection.identity().id()} not found, present are: ${connections.keys.joinToString(",")}}")
+ throw NoSuchElementException("No connection available")
+ }
return conn
}
diff --git a/eth-client/src/main/resources/logback.xml b/eth-client/src/main/resources/logback.xml
index cb63fd52..4d1a5fe5 100644
--- a/eth-client/src/main/resources/logback.xml
+++ b/eth-client/src/main/resources/logback.xml
@@ -11,7 +11,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->
-<configuration>
+<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
@@ -20,8 +20,20 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
+ <logger level="info" name="org.infinispan" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger level="info" name="io.netty.buffer" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger level="info" name="org.xbill.DNS" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger level="info" name="org.eclipse.jetty" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <root level="info">
+ <root level="${root.log.level:-INFO}">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org