mirror of
https://github.com/corda/corda.git
synced 2025-02-03 17:50:41 +00:00
Introduce contextLogger (#2085)
* Revert with comment, probably lazy for a reason.
This commit is contained in:
parent
273965f17a
commit
f26aa33553
@ -7,7 +7,7 @@ import com.google.common.collect.HashMultimap
|
||||
import com.google.common.collect.Multimap
|
||||
import net.corda.client.jackson.StringToMethodCallParser.ParsedMethodCall
|
||||
import net.corda.core.CordaException
|
||||
import org.slf4j.LoggerFactory
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Method
|
||||
import java.util.concurrent.Callable
|
||||
@ -90,7 +90,7 @@ open class StringToMethodCallParser<in T : Any> @JvmOverloads constructor(
|
||||
return result
|
||||
}
|
||||
|
||||
private val log = LoggerFactory.getLogger(StringToMethodCallParser::class.java)!!
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
/** The methods that can be invoked via this parser. */
|
||||
|
@ -11,10 +11,7 @@ import net.corda.core.messaging.RPCOps
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.internal.nodeSerializationEnv
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.minutes
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.nodeapi.ArtemisTcpTransport.Companion.tcpTransport
|
||||
import net.corda.nodeapi.ConnectionDirection
|
||||
import net.corda.nodeapi.RPCApi
|
||||
@ -96,7 +93,7 @@ class RPCClient<I : RPCOps>(
|
||||
) : this(tcpTransport(ConnectionDirection.Outbound(), hostAndPort, sslConfiguration), configuration, serializationContext)
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<RPCClient<*>>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
fun start(
|
||||
|
@ -22,10 +22,7 @@ import net.corda.core.internal.ThreadBox
|
||||
import net.corda.core.messaging.RPCOps
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.Try
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.nodeapi.ArtemisConsumer
|
||||
import net.corda.nodeapi.ArtemisProducer
|
||||
import net.corda.nodeapi.RPCApi
|
||||
@ -91,7 +88,7 @@ class RPCClientProxyHandler(
|
||||
private val lifeCycle = LifeCycle(State.UNSTARTED)
|
||||
|
||||
private companion object {
|
||||
val log = loggerFor<RPCClientProxyHandler>()
|
||||
private val log = contextLogger()
|
||||
// To check whether toString() is being invoked
|
||||
val toStringMethod: Method = Object::toString.javaMethod!!
|
||||
|
||||
|
@ -11,10 +11,7 @@ import net.corda.core.messaging.*
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.node.services.Vault
|
||||
import net.corda.core.node.services.vault.*
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.finance.DOLLARS
|
||||
import net.corda.finance.POUNDS
|
||||
import net.corda.finance.SWISS_FRANCS
|
||||
@ -45,7 +42,7 @@ import kotlin.test.assertTrue
|
||||
|
||||
class StandaloneCordaRPClientTest {
|
||||
private companion object {
|
||||
val log = loggerFor<StandaloneCordaRPClientTest>()
|
||||
private val log = contextLogger()
|
||||
val user = User("user1", "test", permissions = setOf("ALL"))
|
||||
val port = AtomicInteger(15200)
|
||||
const val attachmentSize = 2116
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.corda.core.internal
|
||||
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.slf4j.Logger
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.reflect.KProperty
|
||||
@ -47,8 +47,12 @@ class ThreadLeakException : RuntimeException("Leaked thread detected: ${Thread.c
|
||||
|
||||
/** @param isAGlobalThreadBeingCreated whether a global thread (that should not inherit any value) is being created. */
|
||||
class InheritableThreadLocalToggleField<T>(name: String,
|
||||
private val log: Logger = loggerFor<InheritableThreadLocalToggleField<*>>(),
|
||||
private val log: Logger = staticLog,
|
||||
private val isAGlobalThreadBeingCreated: (Array<StackTraceElement>) -> Boolean) : ToggleField<T>(name) {
|
||||
companion object {
|
||||
private val staticLog = contextLogger()
|
||||
}
|
||||
|
||||
private inner class Holder(value: T) : AtomicReference<T?>(value) {
|
||||
fun valueOrDeclareLeak() = get() ?: throw ThreadLeakException()
|
||||
fun childValue(): Holder? {
|
||||
|
@ -3,8 +3,8 @@ package net.corda.core.internal.concurrent
|
||||
import net.corda.core.internal.VisibleForTesting
|
||||
import net.corda.core.concurrent.CordaFuture
|
||||
import net.corda.core.concurrent.match
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import org.slf4j.Logger
|
||||
import java.time.Duration
|
||||
import java.util.concurrent.CompletableFuture
|
||||
@ -118,7 +118,7 @@ interface OpenFuture<V> : ValueOrException<V>, CordaFuture<V>
|
||||
@VisibleForTesting
|
||||
internal class CordaFutureImpl<V>(private val impl: CompletableFuture<V> = CompletableFuture()) : Future<V> by impl, OpenFuture<V> {
|
||||
companion object {
|
||||
private val defaultLog = loggerFor<CordaFutureImpl<*>>()
|
||||
private val defaultLog = contextLogger()
|
||||
internal val listenerFailedMessage = "Future listener failed:"
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import net.corda.core.identity.Party
|
||||
import net.corda.core.node.ServiceHub
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.slf4j.Logger
|
||||
import java.security.PublicKey
|
||||
|
||||
@ -45,8 +45,11 @@ abstract class NotaryService : SingletonSerializeAsToken() {
|
||||
* of the cluster is sufficient for transaction notarisation. For example, a single-node or a Raft notary.
|
||||
*/
|
||||
abstract class TrustedAuthorityNotaryService : NotaryService() {
|
||||
protected open val log: Logger = loggerFor<TrustedAuthorityNotaryService>()
|
||||
companion object {
|
||||
private val staticLog = contextLogger()
|
||||
}
|
||||
|
||||
protected open val log: Logger get() = staticLog
|
||||
// TODO: specify the valid time window in config, and convert TimeWindowChecker to a utility method
|
||||
protected abstract val timeWindowChecker: TimeWindowChecker
|
||||
protected abstract val uniquenessProvider: UniquenessProvider
|
||||
|
@ -24,12 +24,19 @@ infix fun Int.exactAdd(b: Int): Int = Math.addExact(this, b)
|
||||
infix fun Long.exactAdd(b: Long): Long = Math.addExact(this, b)
|
||||
|
||||
/**
|
||||
* Get the [Logger] for a class using the syntax
|
||||
* Usually you won't need this method:
|
||||
* * If you're in a companion object, use [contextLogger]
|
||||
* * If you're in an object singleton, use [LoggerFactory.getLogger] directly on javaClass
|
||||
*
|
||||
* `val logger = loggerFor<MyClass>()`
|
||||
* Otherwise, this gets the [Logger] for a class using the syntax
|
||||
*
|
||||
* `private val log = loggerFor<MyClass>()`
|
||||
*/
|
||||
inline fun <reified T : Any> loggerFor(): Logger = LoggerFactory.getLogger(T::class.java)
|
||||
|
||||
/** When called from a companion object, returns the logger for the enclosing class. */
|
||||
fun Any.contextLogger(): Logger = LoggerFactory.getLogger(javaClass.enclosingClass)
|
||||
|
||||
/** Log a TRACE level message produced by evaluating the given lamdba, but only if TRACE logging is enabled. */
|
||||
inline fun Logger.trace(msg: () -> String) {
|
||||
if (isTraceEnabled) trace(msg())
|
||||
|
@ -9,10 +9,7 @@ import net.corda.core.node.services.CordaService
|
||||
import net.corda.core.serialization.CordaSerializable
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.ProgressTracker
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.unwrap
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.finance.flows.AbstractCashFlow
|
||||
import net.corda.finance.flows.CashException
|
||||
import net.corda.finance.flows.CashIssueFlow
|
||||
@ -25,7 +22,7 @@ object CustomVaultQuery {
|
||||
@CordaService
|
||||
class Service(val services: AppServiceHub) : SingletonSerializeAsToken() {
|
||||
private companion object {
|
||||
val log = loggerFor<Service>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
fun rebalanceCurrencyReserves(): List<Amount<Currency>> {
|
||||
val nativeQuery = """
|
||||
|
@ -4,7 +4,7 @@ import net.corda.core.contracts.*
|
||||
import net.corda.core.contracts.Amount.Companion.sumOrThrow
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.transactions.TransactionBuilder
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.trace
|
||||
import java.security.PublicKey
|
||||
import java.util.*
|
||||
@ -32,8 +32,7 @@ data class PartyAndAmount<T : Any>(val party: AbstractParty, val amount: Amount<
|
||||
*/
|
||||
abstract class OnLedgerAsset<T : Any, C : CommandData, S : FungibleAsset<T>> : Contract {
|
||||
companion object {
|
||||
val log = loggerFor<OnLedgerAsset<*, *, *>>()
|
||||
|
||||
private val log = contextLogger()
|
||||
/**
|
||||
* Generate a transaction that moves an amount of currency to the given pubkey.
|
||||
*
|
||||
|
@ -4,15 +4,12 @@ import co.paralleluniverse.fibers.Suspendable
|
||||
import net.corda.core.contracts.Amount
|
||||
import net.corda.core.contracts.StateAndRef
|
||||
import net.corda.core.contracts.StateRef
|
||||
import net.corda.core.contracts.TransactionState
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.node.ServiceHub
|
||||
import net.corda.core.node.services.StatesNotAvailableException
|
||||
import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.finance.contracts.asset.Cash
|
||||
import java.sql.*
|
||||
@ -44,7 +41,7 @@ abstract class AbstractCashSelection {
|
||||
}.invoke()
|
||||
}
|
||||
|
||||
val log = loggerFor<AbstractCashSelection>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
// coin selection retry loop counter, sleep (msecs) and lock for selecting states
|
||||
|
@ -5,8 +5,8 @@ import net.corda.core.crypto.toStringShort
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import java.sql.Connection
|
||||
import java.sql.DatabaseMetaData
|
||||
import java.sql.ResultSet
|
||||
@ -15,7 +15,7 @@ import java.util.*
|
||||
class CashSelectionH2Impl : AbstractCashSelection() {
|
||||
companion object {
|
||||
const val JDBC_DRIVER_NAME = "H2 JDBC Driver"
|
||||
val log = loggerFor<CashSelectionH2Impl>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
override fun isCompatible(metadata: DatabaseMetaData): Boolean {
|
||||
|
@ -3,10 +3,7 @@ package net.corda.finance.contracts.asset.cash.selection
|
||||
import net.corda.core.contracts.Amount
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.toBase58String
|
||||
import net.corda.core.utilities.*
|
||||
import java.sql.Connection
|
||||
import java.sql.DatabaseMetaData
|
||||
import java.sql.ResultSet
|
||||
@ -16,7 +13,7 @@ class CashSelectionPostgreSQLImpl : AbstractCashSelection() {
|
||||
|
||||
companion object {
|
||||
val JDBC_DRIVER_NAME = "PostgreSQL JDBC Driver"
|
||||
val log = loggerFor<CashSelectionPostgreSQLImpl>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
override fun isCompatible(metadata: DatabaseMetaData): Boolean {
|
||||
|
@ -5,7 +5,7 @@ import net.corda.core.internal.ThreadBox
|
||||
import net.corda.core.internal.createDirectories
|
||||
import net.corda.core.internal.isRegularFile
|
||||
import net.corda.core.internal.list
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import rx.Observable
|
||||
import rx.Scheduler
|
||||
import rx.Subscription
|
||||
@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit
|
||||
class NodeInfoFilesCopier(scheduler: Scheduler = Schedulers.io()) : AutoCloseable {
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<NodeInfoFilesCopier>()
|
||||
private val log = contextLogger()
|
||||
const val NODE_INFO_FILE_NAME_PREFIX = "nodeInfo-"
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import net.corda.nodeapi.internal.AttachmentsClassLoader
|
||||
import net.corda.core.serialization.ClassWhitelist
|
||||
import net.corda.core.serialization.CordaSerializable
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.nodeapi.internal.serialization.amqp.hasAnnotationInHierarchy
|
||||
import net.corda.nodeapi.internal.serialization.kryo.ThrowableSerializer
|
||||
import java.io.PrintWriter
|
||||
@ -187,7 +187,7 @@ class TransientClassWhiteList(delegate: ClassWhitelist) : AbstractMutableClassWh
|
||||
@Suppress("unused")
|
||||
class LoggingWhitelist(val delegate: ClassWhitelist, val global: Boolean = true) : MutableClassWhitelist {
|
||||
companion object {
|
||||
val log = loggerFor<LoggingWhitelist>()
|
||||
private val log = contextLogger()
|
||||
val globallySeen: MutableSet<String> = Collections.synchronizedSet(mutableSetOf())
|
||||
val journalWriter: PrintWriter? = openOptionalDynamicWhitelistJournal()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.corda.nodeapi.internal.serialization.amqp
|
||||
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.nodeapi.internal.serialization.amqp.SerializerFactory.Companion.nameForType
|
||||
import org.apache.qpid.proton.amqp.Symbol
|
||||
import org.apache.qpid.proton.codec.Data
|
||||
@ -17,7 +17,9 @@ open class ObjectSerializer(val clazz: Type, factory: SerializerFactory) : AMQPS
|
||||
open val kotlinConstructor = constructorForDeserialization(clazz)
|
||||
val javaConstructor by lazy { kotlinConstructor?.javaConstructor }
|
||||
|
||||
private val logger = loggerFor<ObjectSerializer>()
|
||||
companion object {
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
open internal val propertySerializers: Collection<PropertySerializer> by lazy {
|
||||
propertiesForSerialization(kotlinConstructor, clazz, factory)
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.corda.nodeapi.internal.serialization.amqp
|
||||
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.apache.qpid.proton.amqp.Binary
|
||||
import org.apache.qpid.proton.codec.Data
|
||||
import java.lang.reflect.Method
|
||||
@ -61,8 +61,7 @@ sealed class PropertySerializer(val name: String, val readMethod: Method?, val r
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = loggerFor<PropertySerializer>()
|
||||
|
||||
private val logger = contextLogger()
|
||||
fun make(name: String, readMethod: Method?, resolvedType: Type, factory: SerializerFactory): PropertySerializer {
|
||||
readMethod?.isAccessible = true
|
||||
if (SerializerFactory.isPrimitive(resolvedType)) {
|
||||
|
@ -3,14 +3,14 @@ package net.corda.nodeapi.internal.serialization.amqp.custom
|
||||
import net.corda.core.CordaRuntimeException
|
||||
import net.corda.core.CordaThrowable
|
||||
import net.corda.core.serialization.SerializationFactory
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.nodeapi.internal.serialization.amqp.*
|
||||
import java.io.NotSerializableException
|
||||
|
||||
class ThrowableSerializer(factory: SerializerFactory) : CustomSerializer.Proxy<Throwable, ThrowableSerializer.ThrowableProxy>(Throwable::class.java, ThrowableProxy::class.java, factory) {
|
||||
|
||||
companion object {
|
||||
private val logger = loggerFor<ThrowableSerializer>()
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
override val revealSubclassesInSchema: Boolean = true
|
||||
|
@ -13,8 +13,8 @@ import net.corda.core.internal.div
|
||||
import net.corda.core.internal.toLedgerTransaction
|
||||
import net.corda.core.serialization.SerializationFactory
|
||||
import net.corda.core.transactions.TransactionBuilder
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.internal.cordapp.CordappLoader
|
||||
import net.corda.node.internal.cordapp.CordappProviderImpl
|
||||
import net.corda.testing.*
|
||||
@ -41,7 +41,7 @@ class AttachmentLoadingTests {
|
||||
}
|
||||
|
||||
private companion object {
|
||||
val logger = loggerFor<AttachmentLoadingTests>()
|
||||
private val logger = contextLogger()
|
||||
val isolatedJAR = AttachmentLoadingTests::class.java.getResource("isolated.jar")!!
|
||||
val ISOLATED_CONTRACT_ID = "net.corda.finance.contracts.isolated.AnotherDummyContract"
|
||||
|
||||
|
@ -20,8 +20,8 @@ import net.corda.core.node.services.NetworkMapCache
|
||||
import net.corda.core.node.services.Vault
|
||||
import net.corda.core.node.services.vault.*
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.services.api.FlowStarter
|
||||
import net.corda.node.services.api.ServiceHubInternal
|
||||
import net.corda.node.services.messaging.context
|
||||
@ -296,6 +296,6 @@ internal class CordaRPCOpsImpl(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<CordaRPCOpsImpl>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
}
|
@ -10,9 +10,9 @@ import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.node.ServiceHub
|
||||
import net.corda.core.node.services.TransactionVerifierService
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.serialization.internal.SerializationEnvironmentImpl
|
||||
import net.corda.core.serialization.internal.nodeSerializationEnv
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.VersionInfo
|
||||
import net.corda.node.internal.cordapp.CordappLoader
|
||||
import net.corda.node.serialization.KryoServerSerializationScheme
|
||||
@ -50,7 +50,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
cordappLoader: CordappLoader = makeCordappLoader(configuration)
|
||||
) : AbstractNode(configuration, createClock(configuration), versionInfo, cordappLoader) {
|
||||
companion object {
|
||||
private val logger = loggerFor<Node>()
|
||||
private val staticLog = contextLogger()
|
||||
var renderBasicInfoToConsole = true
|
||||
|
||||
/** Used for useful info that we always want to show, even when not logging to the console */
|
||||
@ -80,7 +80,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
}
|
||||
}
|
||||
|
||||
override val log: Logger get() = logger
|
||||
override val log: Logger get() = staticLog
|
||||
override fun makeTransactionVerifierService(): TransactionVerifierService = when (configuration.verifierType) {
|
||||
VerifierType.OutOfProcess -> verifierMessagingClient!!.verifierService
|
||||
VerifierType.InMemory -> InMemoryTransactionVerifierService(numberOfWorkers = 4)
|
||||
@ -283,7 +283,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
_startupComplete.set(Unit)
|
||||
}
|
||||
},
|
||||
{ th -> logger.error("Unexpected exception", th) }
|
||||
{ th -> staticLog.error("Unexpected exception", th) } // XXX: Why not use log?
|
||||
)
|
||||
shutdownHook = addShutdownHook {
|
||||
stop()
|
||||
|
@ -29,7 +29,7 @@ import kotlin.system.exitProcess
|
||||
/** This class is responsible for starting a Node from command line arguments. */
|
||||
open class NodeStartup(val args: Array<String>) {
|
||||
companion object {
|
||||
private val logger by lazy { loggerFor<Node>() }
|
||||
private val logger by lazy { loggerFor<Node>() } // I guess this is lazy to allow for logging init, but why Node?
|
||||
val LOGS_DIRECTORY_NAME = "logs"
|
||||
val LOGS_CAN_BE_FOUND_IN_STRING = "Logs can be found in"
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import net.corda.core.node.services.CordaService
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.serialization.SerializationWhitelist
|
||||
import net.corda.core.serialization.SerializeAsToken
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.internal.classloading.requireAnnotation
|
||||
import net.corda.node.services.config.NodeConfiguration
|
||||
import net.corda.nodeapi.internal.serialization.DefaultWhitelist
|
||||
@ -53,8 +53,7 @@ class CordappLoader private constructor(private val cordappJarPaths: List<Restri
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = loggerFor<CordappLoader>()
|
||||
|
||||
private val logger = contextLogger()
|
||||
/**
|
||||
* Default cordapp dir name
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ import net.corda.core.node.services.NetworkMapCache
|
||||
import net.corda.core.node.services.NetworkMapCacheBase
|
||||
import net.corda.core.node.services.TransactionStorage
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.internal.InitiatedFlowFactory
|
||||
import net.corda.node.internal.cordapp.CordappProviderInternal
|
||||
import net.corda.node.services.config.NodeConfiguration
|
||||
@ -43,7 +43,7 @@ interface NetworkMapCacheBaseInternal : NetworkMapCacheBase {
|
||||
|
||||
interface ServiceHubInternal : ServiceHub {
|
||||
companion object {
|
||||
private val log = loggerFor<ServiceHubInternal>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
override val vaultService: VaultServiceInternal
|
||||
|
@ -8,12 +8,12 @@ import net.corda.core.crypto.Crypto
|
||||
import net.corda.core.crypto.SignatureScheme
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.internal.*
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.utilities.*
|
||||
import net.corda.nodeapi.config.SSLConfiguration
|
||||
import org.bouncycastle.asn1.x509.GeneralName
|
||||
import org.bouncycastle.asn1.x509.GeneralSubtree
|
||||
import org.bouncycastle.asn1.x509.NameConstraints
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.file.Path
|
||||
import java.security.KeyStore
|
||||
|
||||
@ -21,8 +21,7 @@ fun configOf(vararg pairs: Pair<String, Any?>): Config = ConfigFactory.parseMap(
|
||||
operator fun Config.plus(overrides: Map<String, Any?>): Config = ConfigFactory.parseMap(overrides).withFallback(this)
|
||||
|
||||
object ConfigHelper {
|
||||
private val log = loggerFor<ConfigHelper>()
|
||||
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
fun loadConfig(baseDirectory: Path,
|
||||
configFile: Path = baseDirectory / "node.conf",
|
||||
allowMissingConfig: Boolean = false,
|
||||
|
@ -17,7 +17,7 @@ import net.corda.core.internal.until
|
||||
import net.corda.core.node.StateLoader
|
||||
import net.corda.core.schemas.PersistentStateRef
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.trace
|
||||
import net.corda.node.internal.MutableClock
|
||||
import net.corda.node.services.api.FlowStarter
|
||||
@ -65,8 +65,7 @@ class NodeSchedulerService(private val clock: Clock,
|
||||
: SchedulerService, SingletonSerializeAsToken() {
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<NodeSchedulerService>()
|
||||
|
||||
private val log = contextLogger()
|
||||
/**
|
||||
* Wait until the given [Future] is complete or the deadline is reached, with support for [MutableClock] implementations
|
||||
* used in demos or testing. This will substitute a Fiber compatible Future so the current
|
||||
|
@ -8,7 +8,7 @@ import net.corda.core.internal.toX509CertHolder
|
||||
import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.node.services.UnknownAnonymousPartyException
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.trace
|
||||
import org.bouncycastle.cert.X509CertificateHolder
|
||||
import java.security.InvalidAlgorithmParameterException
|
||||
@ -16,7 +16,6 @@ import java.security.PublicKey
|
||||
import java.security.cert.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import javax.annotation.concurrent.ThreadSafe
|
||||
import javax.security.auth.x500.X500Principal
|
||||
|
||||
/**
|
||||
* Simple identity service which caches parties and provides functionality for efficient lookup.
|
||||
@ -33,7 +32,7 @@ class InMemoryIdentityService(identities: Iterable<PartyAndCertificate> = emptyS
|
||||
trustRoot: X509CertificateHolder) : this(wellKnownIdentities, confidentialIdentities, trustRoot.cert)
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<InMemoryIdentityService>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,11 +10,10 @@ import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.node.services.UnknownAnonymousPartyException
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.MAX_HASH_HEX_SIZE
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.utilities.AppendOnlyPersistentMap
|
||||
import net.corda.node.utilities.NODE_DATABASE_PREFIX
|
||||
import net.corda.node.utilities.X509Utilities
|
||||
import org.bouncycastle.cert.X509CertificateHolder
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.security.InvalidAlgorithmParameterException
|
||||
@ -36,7 +35,7 @@ class PersistentIdentityService(identities: Iterable<PartyAndCertificate> = empt
|
||||
trustRoot: X509CertificateHolder) : this(wellKnownIdentities, confidentialIdentities, trustRoot.cert)
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<PersistentIdentityService>()
|
||||
private val log = contextLogger()
|
||||
private val certFactory: CertificateFactory = CertificateFactory.getInstance("X.509")
|
||||
|
||||
fun createPKMap(): AppendOnlyPersistentMap<SecureHash, PartyAndCertificate, PersistentIdentity, String> {
|
||||
|
@ -12,10 +12,7 @@ import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.node.services.NetworkMapCache
|
||||
import net.corda.core.node.services.NetworkMapCache.MapChange
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.parsePublicKeyBase58
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.node.internal.Node
|
||||
import net.corda.node.services.RPCUserService
|
||||
import net.corda.node.services.config.NodeConfiguration
|
||||
@ -99,7 +96,7 @@ class ArtemisMessagingServer(private val config: NodeConfiguration,
|
||||
val networkMapCache: NetworkMapCache,
|
||||
val userService: RPCUserService) : SingletonSerializeAsToken() {
|
||||
companion object {
|
||||
private val log = loggerFor<ArtemisMessagingServer>()
|
||||
private val log = contextLogger()
|
||||
/** 10 MiB maximum allowed file size for attachments, including message headers. TODO: acquire this value from Network Map when supported. */
|
||||
@JvmStatic
|
||||
val MAX_FILE_SIZE = 10485760
|
||||
@ -419,7 +416,7 @@ private class VerifyingNettyConnector(configuration: MutableMap<String, Any>,
|
||||
protocolManager: ClientProtocolManager?) :
|
||||
NettyConnector(configuration, handler, listener, closeExecutor, threadPool, scheduledThreadPool, protocolManager) {
|
||||
companion object {
|
||||
private val log = loggerFor<VerifyingNettyConnector>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration)
|
||||
@ -542,8 +539,7 @@ class NodeLoginModule : LoginModule {
|
||||
const val VERIFIER_ROLE = "SystemRoles/Verifier"
|
||||
|
||||
const val CERT_CHAIN_CHECKS_OPTION_NAME = "CertChainChecks"
|
||||
|
||||
val log = loggerFor<NodeLoginModule>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private var loginSucceeded: Boolean = false
|
||||
|
@ -10,8 +10,8 @@ import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.sequence
|
||||
import net.corda.core.utilities.trace
|
||||
import net.corda.node.VersionInfo
|
||||
@ -68,7 +68,7 @@ class P2PMessagingClient(config: NodeConfiguration,
|
||||
advertisedAddress: NetworkHostAndPort = serverAddress
|
||||
) : SingletonSerializeAsToken(), MessagingService {
|
||||
companion object {
|
||||
private val log = loggerFor<P2PMessagingClient>()
|
||||
private val log = contextLogger()
|
||||
// This is a "property" attached to an Artemis MQ message object, which contains our own notion of "topic".
|
||||
// We should probably try to unify our notion of "topic" (really, just a string that identifies an endpoint
|
||||
// that will handle messages, like a URL) with the terminology used by underlying MQ libraries, to avoid
|
||||
|
@ -24,10 +24,7 @@ import net.corda.core.messaging.RPCOps
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.SerializationDefaults.RPC_SERVER_CONTEXT
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.utilities.Try
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.node.services.RPCUserService
|
||||
import net.corda.node.services.logging.pushToLoggingContext
|
||||
import net.corda.nodeapi.*
|
||||
@ -42,6 +39,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator
|
||||
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl
|
||||
import org.apache.activemq.artemis.api.core.management.CoreNotificationType
|
||||
import org.apache.activemq.artemis.api.core.management.ManagementHelper
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.slf4j.MDC
|
||||
import rx.Notification
|
||||
import rx.Observable
|
||||
@ -90,7 +88,7 @@ class RPCServer(
|
||||
private val rpcConfiguration: RPCServerConfiguration = RPCServerConfiguration.default
|
||||
) {
|
||||
private companion object {
|
||||
val log = loggerFor<RPCServer>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private enum class State {
|
||||
@ -442,7 +440,7 @@ class ObservableContext(
|
||||
val observationSendExecutor: ExecutorService
|
||||
) {
|
||||
private companion object {
|
||||
val log = loggerFor<ObservableContext>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val serializationContextWithObservableContext = RpcServerObservableSerializer.createContext(this)
|
||||
@ -465,8 +463,7 @@ class ObservableContext(
|
||||
object RpcServerObservableSerializer : Serializer<Observable<*>>() {
|
||||
private object RpcObservableContextKey
|
||||
|
||||
private val log = loggerFor<RpcServerObservableSerializer>()
|
||||
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
fun createContext(observableContext: ObservableContext): SerializationContext {
|
||||
return RPC_SERVER_CONTEXT.withProperty(RpcServerObservableSerializer.RpcObservableContextKey, observableContext)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import net.corda.core.internal.openHttpConnection
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.minutes
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.node.services.api.NetworkMapCacheInternal
|
||||
@ -25,10 +25,6 @@ import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class NetworkMapClient(compatibilityZoneURL: URL) {
|
||||
companion object {
|
||||
val logger = loggerFor<NetworkMapClient>()
|
||||
}
|
||||
|
||||
private val networkMapUrl = URL("$compatibilityZoneURL/network-map")
|
||||
|
||||
fun publish(signedNodeInfo: SignedData<NodeInfo>) {
|
||||
@ -73,7 +69,7 @@ class NetworkMapUpdater(private val networkMapCache: NetworkMapCacheInternal,
|
||||
private val fileWatcher: NodeInfoWatcher,
|
||||
private val networkMapClient: NetworkMapClient?) : Closeable {
|
||||
companion object {
|
||||
private val logger = loggerFor<NetworkMapUpdater>()
|
||||
private val logger = contextLogger()
|
||||
private val retryInterval = 1.minutes
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import net.corda.core.internal.*
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.nodeapi.NodeInfoFilesCopier
|
||||
import rx.Observable
|
||||
@ -40,8 +40,7 @@ class NodeInfoWatcher(private val nodePath: Path,
|
||||
val processedNodeInfoHashes: Set<SecureHash> get() = _processedNodeInfoHashes.toSet()
|
||||
|
||||
companion object {
|
||||
private val logger = loggerFor<NodeInfoWatcher>()
|
||||
|
||||
private val logger = contextLogger()
|
||||
/**
|
||||
* Saves the given [NodeInfo] to a path.
|
||||
* The node is 'encoded' as a SignedData<NodeInfo>, signed with the owning key of its first identity.
|
||||
|
@ -19,7 +19,7 @@ import net.corda.core.node.services.PartyInfo
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.services.api.NetworkMapCacheBaseInternal
|
||||
import net.corda.node.services.api.NetworkMapCacheInternal
|
||||
import net.corda.node.utilities.CordaPersistence
|
||||
@ -63,7 +63,7 @@ class NetworkMapCacheImpl(
|
||||
@ThreadSafe
|
||||
open class PersistentNetworkMapCache(private val database: CordaPersistence) : SingletonSerializeAsToken(), NetworkMapCacheBaseInternal {
|
||||
companion object {
|
||||
val logger = loggerFor<PersistentNetworkMapCache>()
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
// TODO Small explanation, partyNodes and registeredNodes is left in memory as it was before, because it will be removed in
|
||||
|
@ -3,7 +3,7 @@ package net.corda.node.services.persistence
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.hibernate.type.descriptor.WrapperOptions
|
||||
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor
|
||||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan
|
||||
@ -11,7 +11,7 @@ import org.hibernate.type.descriptor.java.MutabilityPlan
|
||||
|
||||
class AbstractPartyDescriptor(identitySvc: () -> IdentityService) : AbstractTypeDescriptor<AbstractParty>(AbstractParty::class.java) {
|
||||
companion object {
|
||||
private val log = loggerFor<AbstractPartyDescriptor>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val identityService: IdentityService by lazy(identitySvc)
|
||||
|
@ -3,7 +3,7 @@ package net.corda.node.services.persistence
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import javax.persistence.AttributeConverter
|
||||
import javax.persistence.Converter
|
||||
|
||||
@ -14,7 +14,7 @@ import javax.persistence.Converter
|
||||
@Converter(autoApply = true)
|
||||
class AbstractPartyToX500NameAsStringConverter(identitySvc: () -> IdentityService) : AttributeConverter<AbstractParty, String> {
|
||||
companion object {
|
||||
private val log = loggerFor<AbstractPartyToX500NameAsStringConverter>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val identityService: IdentityService by lazy(identitySvc)
|
||||
|
@ -3,8 +3,7 @@ package net.corda.node.services.persistence
|
||||
import net.corda.core.internal.castIfPossible
|
||||
import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.toHexString
|
||||
import net.corda.node.services.api.SchemaService
|
||||
import net.corda.node.utilities.DatabaseTransactionManager
|
||||
@ -29,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class HibernateConfiguration(val schemaService: SchemaService, private val databaseProperties: Properties, private val createIdentityService: () -> IdentityService) {
|
||||
companion object {
|
||||
val logger = loggerFor<HibernateConfiguration>()
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
// TODO: make this a guava cache or similar to limit ability for this to grow forever.
|
||||
|
@ -14,13 +14,12 @@ import net.corda.core.node.services.AttachmentId
|
||||
import net.corda.core.node.services.AttachmentStorage
|
||||
import net.corda.core.node.services.vault.*
|
||||
import net.corda.core.serialization.*
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.services.vault.HibernateAttachmentQueryCriteriaParser
|
||||
import net.corda.node.utilities.DatabaseTransactionManager
|
||||
import net.corda.node.utilities.NODE_DATABASE_PREFIX
|
||||
import net.corda.node.utilities.currentDBSession
|
||||
import java.io.*
|
||||
import java.lang.Exception
|
||||
import java.nio.file.Paths
|
||||
import java.time.Instant
|
||||
import java.util.jar.JarInputStream
|
||||
@ -57,7 +56,7 @@ class NodeAttachmentService(metrics: MetricRegistry) : AttachmentStorage, Single
|
||||
) : Serializable
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<NodeAttachmentService>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -7,8 +7,8 @@ import net.corda.core.internal.VisibleForTesting
|
||||
import net.corda.core.node.services.Vault
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.schemas.PersistentStateRef
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.services.persistence.HibernateConfiguration
|
||||
import net.corda.node.utilities.DatabaseTransactionManager
|
||||
import org.hibernate.FlushMode
|
||||
@ -20,7 +20,7 @@ import rx.Observable
|
||||
// TODO: Manage version evolution of the schemas via additional tooling.
|
||||
class HibernateObserver private constructor(private val config: HibernateConfiguration) {
|
||||
companion object {
|
||||
private val log = loggerFor<HibernateObserver>()
|
||||
private val log = contextLogger()
|
||||
@JvmStatic
|
||||
fun install(vaultUpdates: Observable<Vault.Update<ContractState>>, config: HibernateConfiguration): HibernateObserver {
|
||||
val observer = HibernateObserver(config)
|
||||
|
@ -3,7 +3,7 @@ package net.corda.node.services.statemachine
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.flows.FlowStackSnapshot
|
||||
import net.corda.core.flows.StateMachineRunId
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.file.Path
|
||||
import java.util.*
|
||||
|
||||
@ -26,8 +26,7 @@ interface FlowStackSnapshotFactory {
|
||||
fun persistAsJsonFile(flowClass: Class<out FlowLogic<*>>, baseDir: Path, flowId: StateMachineRunId)
|
||||
|
||||
private object DefaultFlowStackSnapshotFactory : FlowStackSnapshotFactory {
|
||||
private val log = loggerFor<DefaultFlowStackSnapshotFactory>()
|
||||
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
override fun getFlowStackSnapshot(flowClass: Class<out FlowLogic<*>>): FlowStackSnapshot? {
|
||||
log.warn("Flow stack snapshot are not supposed to be used in a production deployment")
|
||||
return null
|
||||
|
@ -27,10 +27,7 @@ import net.corda.core.serialization.SerializationDefaults.SERIALIZATION_FACTORY
|
||||
import net.corda.core.serialization.SerializedBytes
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.Try
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.trace
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.node.internal.InitiatedFlowFactory
|
||||
import net.corda.node.services.api.Checkpoint
|
||||
import net.corda.node.services.api.CheckpointStorage
|
||||
@ -67,7 +64,7 @@ class StateMachineManagerImpl(
|
||||
inner class FiberScheduler : FiberExecutorScheduler("Same thread scheduler", executor)
|
||||
|
||||
companion object {
|
||||
private val logger = loggerFor<StateMachineManagerImpl>()
|
||||
private val logger = contextLogger()
|
||||
internal val sessionTopic = TopicSession("platform.session")
|
||||
|
||||
init {
|
||||
|
@ -16,7 +16,6 @@ import net.corda.core.node.services.NotaryService
|
||||
import net.corda.core.node.services.TimeWindowChecker
|
||||
import net.corda.core.node.services.UniquenessProvider
|
||||
import net.corda.core.schemas.PersistentStateRef
|
||||
import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.transactions.FilteredTransaction
|
||||
@ -41,7 +40,7 @@ class BFTNonValidatingNotaryService(override val services: ServiceHubInternal,
|
||||
cluster: BFTSMaRt.Cluster) : NotaryService() {
|
||||
companion object {
|
||||
val id = constructId(validating = false, bft = true)
|
||||
private val log = loggerFor<BFTNonValidatingNotaryService>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val client: BFTSMaRt.Client
|
||||
|
@ -29,8 +29,8 @@ import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.transactions.FilteredTransaction
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.services.api.ServiceHubInternal
|
||||
import net.corda.node.services.transactions.BFTSMaRt.Client
|
||||
import net.corda.node.services.transactions.BFTSMaRt.Replica
|
||||
@ -77,7 +77,7 @@ object BFTSMaRt {
|
||||
|
||||
class Client(config: BFTSMaRtConfig, private val clientId: Int, private val cluster: Cluster, private val notaryService: BFTNonValidatingNotaryService) : SingletonSerializeAsToken() {
|
||||
companion object {
|
||||
private val log = loggerFor<Client>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
/** A proxy for communicating with the BFT cluster */
|
||||
@ -181,7 +181,7 @@ object BFTSMaRt {
|
||||
protected val notaryIdentityKey: PublicKey,
|
||||
private val timeWindowChecker: TimeWindowChecker) : DefaultRecoverable() {
|
||||
companion object {
|
||||
private val log = loggerFor<Replica>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val stateManagerOverride = run {
|
||||
|
@ -2,8 +2,8 @@ package net.corda.node.services.transactions
|
||||
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import java.net.InetAddress
|
||||
@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
*/
|
||||
class BFTSMaRtConfig(private val replicaAddresses: List<NetworkHostAndPort>, debug: Boolean, val exposeRaces: Boolean) : PathManager<BFTSMaRtConfig>(Files.createTempDirectory("bft-smart-config")) {
|
||||
companion object {
|
||||
private val log = loggerFor<BFTSMaRtConfig>()
|
||||
private val log = contextLogger()
|
||||
internal val portIsClaimedFormat = "Port %s is claimed by another replica: %s"
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import io.atomix.copycat.Command
|
||||
import io.atomix.copycat.Query
|
||||
import io.atomix.copycat.server.Commit
|
||||
import io.atomix.copycat.server.StateMachine
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.utilities.*
|
||||
import java.util.LinkedHashMap
|
||||
|
||||
@ -17,7 +17,7 @@ import java.util.LinkedHashMap
|
||||
*/
|
||||
class DistributedImmutableMap<K : Any, V : Any, E, EK>(val db: CordaPersistence, createMap: () -> AppendOnlyPersistentMap<K, Pair<Long, V>, E, EK>) : StateMachine() {
|
||||
companion object {
|
||||
private val log = loggerFor<DistributedImmutableMap<*, *, *, *>>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
object Commands {
|
||||
|
@ -11,7 +11,7 @@ import net.corda.core.internal.concurrent.OpenFuture
|
||||
import net.corda.core.internal.concurrent.openFuture
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.transactions.LedgerTransaction
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.nodeapi.VerifierApi
|
||||
import org.apache.activemq.artemis.api.core.client.ClientConsumer
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@ -21,7 +21,7 @@ class OutOfProcessTransactionVerifierService(
|
||||
private val sendRequest: (Long, LedgerTransaction) -> Unit
|
||||
) : SingletonSerializeAsToken(), TransactionVerifierService {
|
||||
companion object {
|
||||
val log = loggerFor<OutOfProcessTransactionVerifierService>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private data class VerificationHandle(
|
||||
|
@ -9,11 +9,8 @@ import net.corda.core.internal.ThreadBox
|
||||
import net.corda.core.node.services.UniquenessException
|
||||
import net.corda.core.node.services.UniquenessProvider
|
||||
import net.corda.core.schemas.PersistentStateRef
|
||||
import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.utilities.AppendOnlyPersistentMap
|
||||
import net.corda.node.utilities.NODE_DATABASE_PREFIX
|
||||
import java.io.Serializable
|
||||
@ -62,8 +59,7 @@ class PersistentUniquenessProvider : UniquenessProvider, SingletonSerializeAsTok
|
||||
private val mutex = ThreadBox(InnerState())
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<PersistentUniquenessProvider>()
|
||||
|
||||
private val log = contextLogger()
|
||||
fun createMap(): AppendOnlyPersistentMap<StateRef, UniquenessProvider.ConsumingTx, PersistentNotaryCommit, PersistentStateRef> =
|
||||
AppendOnlyPersistentMap(
|
||||
toPersistentEntityKey = { PersistentStateRef(it.txhash.toString(), it.index) },
|
||||
|
@ -26,7 +26,7 @@ import net.corda.core.serialization.SerializationDefaults
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.services.config.RaftConfig
|
||||
import net.corda.node.utilities.AppendOnlyPersistentMap
|
||||
import net.corda.node.utilities.CordaPersistence
|
||||
@ -49,8 +49,7 @@ import javax.persistence.*
|
||||
@ThreadSafe
|
||||
class RaftUniquenessProvider(private val transportConfiguration: NodeSSLConfiguration, private val db: CordaPersistence, private val metrics: MetricRegistry, private val raftConfig: RaftConfig) : UniquenessProvider, SingletonSerializeAsToken() {
|
||||
companion object {
|
||||
private val log = loggerFor<RaftUniquenessProvider>()
|
||||
|
||||
private val log = contextLogger()
|
||||
fun createMap(): AppendOnlyPersistentMap<String, Pair<Long, Any>, RaftState, String> =
|
||||
AppendOnlyPersistentMap(
|
||||
toPersistentEntityKey = { it },
|
||||
|
@ -11,7 +11,7 @@ import net.corda.core.node.services.vault.QueryCriteria.CommonQueryCriteria
|
||||
import net.corda.core.schemas.PersistentState
|
||||
import net.corda.core.schemas.PersistentStateRef
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.trace
|
||||
import net.corda.node.services.persistence.NodeAttachmentService
|
||||
import org.hibernate.query.criteria.internal.expression.LiteralExpression
|
||||
@ -107,7 +107,7 @@ class HibernateAttachmentQueryCriteriaParser(override val criteriaBuilder: Crite
|
||||
AbstractQueryCriteriaParser<AttachmentQueryCriteria, AttachmentsQueryCriteriaParser, AttachmentSort>(), AttachmentsQueryCriteriaParser {
|
||||
|
||||
private companion object {
|
||||
val log = loggerFor<HibernateAttachmentQueryCriteriaParser>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
init {
|
||||
@ -170,7 +170,7 @@ class HibernateQueryCriteriaParser(val contractStateType: Class<out ContractStat
|
||||
val criteriaQuery: CriteriaQuery<Tuple>,
|
||||
val vaultStates: Root<VaultSchemaV1.VaultStates>) : AbstractQueryCriteriaParser<QueryCriteria, IQueryCriteriaParser, Sort>(), IQueryCriteriaParser {
|
||||
private companion object {
|
||||
val log = loggerFor<HibernateQueryCriteriaParser>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
// incrementally build list of join predicates
|
||||
|
@ -57,7 +57,7 @@ class NodeVaultService(
|
||||
hibernateConfig: HibernateConfiguration
|
||||
) : SingletonSerializeAsToken(), VaultServiceInternal {
|
||||
private companion object {
|
||||
val log = loggerFor<NodeVaultService>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private class InnerState {
|
||||
|
@ -4,17 +4,14 @@ import net.corda.core.contracts.FungibleAsset
|
||||
import net.corda.core.contracts.StateRef
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.node.services.VaultService
|
||||
import net.corda.core.utilities.NonEmptySet
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.toNonEmptySet
|
||||
import net.corda.core.utilities.trace
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.node.services.statemachine.FlowStateMachineImpl
|
||||
import net.corda.node.services.statemachine.StateMachineManager
|
||||
import java.util.*
|
||||
|
||||
class VaultSoftLockManager private constructor(private val vault: VaultService) {
|
||||
companion object {
|
||||
private val log = loggerFor<VaultSoftLockManager>()
|
||||
private val log = contextLogger()
|
||||
@JvmStatic
|
||||
fun install(vault: VaultService, smm: StateMachineManager) {
|
||||
val manager = VaultSoftLockManager(vault)
|
||||
|
@ -20,7 +20,6 @@ import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.messaging.DataFeed
|
||||
import net.corda.core.messaging.StateMachineUpdate
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.internal.Node
|
||||
import net.corda.node.internal.StartedNode
|
||||
import net.corda.node.services.messaging.CURRENT_RPC_CONTEXT
|
||||
@ -48,6 +47,7 @@ import org.crsh.util.Utils
|
||||
import org.crsh.vfs.FS
|
||||
import org.crsh.vfs.spi.file.FileMountFactory
|
||||
import org.crsh.vfs.spi.url.ClassPathMountFactory
|
||||
import org.slf4j.LoggerFactory
|
||||
import rx.Observable
|
||||
import rx.Subscriber
|
||||
import java.io.*
|
||||
@ -73,7 +73,7 @@ import kotlin.concurrent.thread
|
||||
// TODO: Make it notice new shell commands added after the node started.
|
||||
|
||||
object InteractiveShell {
|
||||
private val log = loggerFor<InteractiveShell>()
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
private lateinit var node: StartedNode<Node>
|
||||
@VisibleForTesting
|
||||
internal lateinit var database: CordaPersistence
|
||||
|
@ -2,7 +2,6 @@ package net.corda.node.utilities
|
||||
|
||||
import com.google.common.util.concurrent.SettableFuture
|
||||
import com.google.common.util.concurrent.Uninterruptibles
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import java.util.*
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.Executor
|
||||
@ -55,10 +54,6 @@ interface AffinityExecutor : Executor {
|
||||
*/
|
||||
open class ServiceAffinityExecutor(threadName: String, numThreads: Int) : AffinityExecutor,
|
||||
ScheduledThreadPoolExecutor(numThreads) {
|
||||
companion object {
|
||||
val logger = loggerFor<ServiceAffinityExecutor>()
|
||||
}
|
||||
|
||||
private val threads = Collections.synchronizedSet(HashSet<Thread>())
|
||||
|
||||
init {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.corda.node.utilities
|
||||
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.util.*
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ class AppendOnlyPersistentMap<K, V, E, out EK>(
|
||||
) { //TODO determine cacheBound based on entity class later or with node config allowing tuning, or using some heuristic based on heap size
|
||||
|
||||
private companion object {
|
||||
val log = loggerFor<AppendOnlyPersistentMap<*, *, *, *>>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val cache = NonInvalidatingCache<K, Optional<V>>(
|
||||
|
@ -4,7 +4,7 @@ package net.corda.node.utilities
|
||||
import com.google.common.cache.RemovalCause
|
||||
import com.google.common.cache.RemovalListener
|
||||
import com.google.common.cache.RemovalNotification
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.util.*
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ class PersistentMap<K, V, E, out EK>(
|
||||
) : MutableMap<K, V>, AbstractMap<K, V>() {
|
||||
|
||||
private companion object {
|
||||
val log = loggerFor<PersistentMap<*, *, *, *>>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val cache = NonInvalidatingUnboundCache(
|
||||
|
@ -7,13 +7,12 @@ import net.corda.core.identity.Party
|
||||
import net.corda.core.internal.cert
|
||||
import net.corda.core.internal.createDirectories
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.trace
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.file.Path
|
||||
|
||||
object ServiceIdentityGenerator {
|
||||
private val log = loggerFor<ServiceIdentityGenerator>()
|
||||
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
/**
|
||||
* Generates signing key pairs and a common distributed service identity for a set of nodes.
|
||||
* The key pairs and the group identity get serialized to disk in the corresponding node directories.
|
||||
|
@ -5,8 +5,8 @@ import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.finance.flows.CashIssueAndPaymentFlow
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
@ -23,7 +23,7 @@ class BankOfCordaWebApi(val rpc: CordaRPCOps) {
|
||||
val notaryName: CordaX500Name)
|
||||
|
||||
private companion object {
|
||||
val logger = loggerFor<BankOfCordaWebApi>()
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
@GET
|
||||
|
@ -14,8 +14,8 @@ import net.corda.core.contracts.UniqueIdentifier
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.messaging.vaultTrackBy
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.finance.plugin.registerFinanceJSONMappers
|
||||
import net.corda.irs.contract.InterestRateSwap
|
||||
@ -35,7 +35,7 @@ import java.time.LocalDate
|
||||
|
||||
class IRSDemoTest {
|
||||
companion object {
|
||||
val log = loggerFor<IRSDemoTest>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val rpcUsers = listOf(User("user", "password", setOf("ALL")))
|
||||
|
@ -2,7 +2,7 @@ package net.corda.test.spring
|
||||
|
||||
import net.corda.core.concurrent.CordaFuture
|
||||
import net.corda.core.internal.concurrent.map
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.testing.driver.*
|
||||
import net.corda.testing.internal.ProcessUtilities
|
||||
import net.corda.testing.node.NotarySpec
|
||||
@ -61,7 +61,7 @@ fun <A> springDriver(
|
||||
|
||||
data class SpringBootDriverDSL(private val driverDSL: DriverDSL) : DriverDSLInternalInterface by driverDSL, SpringDriverInternalDSLInterface {
|
||||
companion object {
|
||||
val log = loggerFor<SpringBootDriverDSL>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
override fun startSpringBootWebapp(clazz: Class<*>, handle: NodeHandle, checkUrl: String): CordaFuture<WebserverHandle> {
|
||||
|
@ -4,8 +4,8 @@ import net.corda.core.contracts.filterStatesOfType
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.messaging.vaultQueryBy
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.irs.contract.InterestRateSwap
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.web.bind.annotation.*
|
||||
@ -33,8 +33,9 @@ import net.corda.irs.flows.AutoOfferFlow
|
||||
@RestController
|
||||
@RequestMapping("/api/irs")
|
||||
class InterestRateSwapAPI {
|
||||
|
||||
private val logger = loggerFor<InterestRateSwapAPI>()
|
||||
companion object {
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
private fun generateDealLink(deal: InterestRateSwap.State) = "/api/irs/deals/" + deal.common.tradeID
|
||||
|
||||
|
@ -2,8 +2,8 @@ package net.corda.irs.web.api
|
||||
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.irs.api.NodeInterestRates
|
||||
import net.corda.irs.flows.UpdateBusinessDayFlow
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
@ -23,7 +23,7 @@ import java.time.ZoneId
|
||||
@RequestMapping("/api/irs")
|
||||
class InterestRatesSwapDemoAPI {
|
||||
companion object {
|
||||
private val logger = loggerFor<InterestRatesSwapDemoAPI>()
|
||||
private val logger = contextLogger()
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
@ -16,7 +16,7 @@ import com.opengamma.strata.market.param.CurrencyParameterSensitivities
|
||||
import com.opengamma.strata.pricer.rate.ImmutableRatesProvider
|
||||
import com.opengamma.strata.pricer.swap.DiscountingSwapProductPricer
|
||||
import com.opengamma.strata.product.swap.ResolvedSwapTrade
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.vega.flows.toCordaCompatible
|
||||
import java.time.LocalDate
|
||||
|
||||
@ -63,7 +63,7 @@ abstract class AnalyticsEngine {
|
||||
|
||||
class OGSIMMAnalyticsEngine : AnalyticsEngine() {
|
||||
private companion object {
|
||||
val log = loggerFor<OGSIMMAnalyticsEngine>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
override fun curveGroup(): CurveGroupDefinition {
|
||||
|
@ -3,11 +3,10 @@ package net.corda.traderdemo
|
||||
import joptsimple.OptionParser
|
||||
import net.corda.client.rpc.CordaRPCClient
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.finance.DOLLARS
|
||||
import net.corda.testing.DUMMY_BANK_A
|
||||
import net.corda.testing.DUMMY_BANK_B
|
||||
import org.slf4j.Logger
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
/**
|
||||
@ -24,7 +23,7 @@ private class TraderDemo {
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger: Logger = loggerFor<TraderDemo>()
|
||||
private val logger = contextLogger()
|
||||
val buyerName = DUMMY_BANK_A.name
|
||||
val sellerName = DUMMY_BANK_B.name
|
||||
val sellerRpcPort = 10009
|
||||
|
@ -3,10 +3,7 @@ package net.corda.testing.driver
|
||||
import net.corda.core.concurrent.CordaFuture
|
||||
import net.corda.core.internal.ThreadBox
|
||||
import net.corda.core.internal.concurrent.doneFuture
|
||||
import net.corda.core.utilities.Try
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.core.utilities.*
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeoutException
|
||||
@ -21,8 +18,7 @@ class ShutdownManager(private val executorService: ExecutorService) {
|
||||
private val state = ThreadBox(State())
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<ShutdownManager>()
|
||||
|
||||
private val log = contextLogger()
|
||||
inline fun <A> run(providedExecutorService: ExecutorService? = null, block: ShutdownManager.() -> A): A {
|
||||
val executorService = providedExecutorService ?: Executors.newScheduledThreadPool(1)
|
||||
val shutdownManager = ShutdownManager(executorService)
|
||||
|
@ -20,8 +20,8 @@ import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.node.services.KeyManagementService
|
||||
import net.corda.core.serialization.SerializationWhitelist
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.node.internal.AbstractNode
|
||||
import net.corda.node.internal.StartedNode
|
||||
import net.corda.node.internal.cordapp.CordappLoader
|
||||
@ -43,7 +43,6 @@ import net.corda.testing.node.MockServices.Companion.makeTestDataSourcePropertie
|
||||
import net.corda.testing.setGlobalSerialization
|
||||
import net.corda.testing.testNodeConfiguration
|
||||
import org.apache.activemq.artemis.utils.ReusableLatch
|
||||
import org.slf4j.Logger
|
||||
import java.io.Closeable
|
||||
import java.math.BigInteger
|
||||
import java.nio.file.Path
|
||||
@ -214,13 +213,15 @@ class MockNetwork(defaultParameters: MockNetworkParameters = MockNetworkParamete
|
||||
CordappLoader.createDefaultWithTestPackages(args.config, args.network.cordappPackages),
|
||||
args.network.busyLatch
|
||||
) {
|
||||
companion object {
|
||||
private val staticLog = contextLogger()
|
||||
}
|
||||
|
||||
val mockNet = args.network
|
||||
val id = args.id
|
||||
private val entropyRoot = args.entropyRoot
|
||||
var counter = entropyRoot
|
||||
|
||||
override val log: Logger = loggerFor<MockNode>()
|
||||
|
||||
override val log get() = staticLog
|
||||
override val serverThread: AffinityExecutor =
|
||||
if (mockNet.threadPerNode) {
|
||||
ServiceAffinityExecutor("Mock node $id thread", 1)
|
||||
|
@ -6,7 +6,7 @@ import net.corda.core.internal.copyTo
|
||||
import net.corda.core.internal.createDirectories
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import java.time.Instant
|
||||
@ -22,7 +22,7 @@ class NodeProcess(
|
||||
private val client: CordaRPCClient
|
||||
) : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<NodeProcess>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
fun connect(): CordaRPCConnection {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.corda.testing.http
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.net.URL
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit
|
||||
* A small set of utilities for making HttpCalls, aimed at demos and tests.
|
||||
*/
|
||||
object HttpUtils {
|
||||
private val logger = loggerFor<HttpUtils>()
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
private val client by lazy {
|
||||
OkHttpClient.Builder()
|
||||
.connectTimeout(5, TimeUnit.SECONDS)
|
||||
|
@ -3,7 +3,7 @@ package net.corda.demobench.explorer
|
||||
import net.corda.core.internal.createDirectories
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.internal.list
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.demobench.model.JVMConfig
|
||||
import net.corda.demobench.model.NodeConfig
|
||||
import net.corda.demobench.model.NodeConfigWrapper
|
||||
@ -16,7 +16,7 @@ import java.util.concurrent.Executors
|
||||
|
||||
class Explorer internal constructor(private val explorerController: ExplorerController) : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<Explorer>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val executor = Executors.newSingleThreadExecutor()
|
||||
|
@ -5,7 +5,7 @@ import com.jediterm.terminal.ui.UIUtil
|
||||
import com.jediterm.terminal.ui.settings.SettingsProvider
|
||||
import com.pty4j.PtyProcess
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.awt.Dimension
|
||||
import java.io.IOException
|
||||
import java.nio.charset.StandardCharsets.UTF_8
|
||||
@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit.SECONDS
|
||||
|
||||
class R3Pty(val name: CordaX500Name, settings: SettingsProvider, dimension: Dimension, val onExit: (Int) -> Unit) : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<R3Pty>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val executor = Executors.newSingleThreadExecutor()
|
||||
|
@ -4,14 +4,14 @@ import net.corda.client.rpc.CordaRPCClient
|
||||
import net.corda.client.rpc.CordaRPCConnection
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.demobench.model.NodeConfigWrapper
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
|
||||
class NodeRPC(config: NodeConfigWrapper, start: (NodeConfigWrapper, CordaRPCOps) -> Unit, invoke: (CordaRPCOps) -> Unit) : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<NodeRPC>()
|
||||
private val log = contextLogger()
|
||||
val oneSecond = SECONDS.toMillis(1)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.corda.demobench.web
|
||||
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.h2.Driver
|
||||
import org.h2.server.web.LocalWebServer
|
||||
import org.h2.tools.Server
|
||||
@ -11,7 +11,7 @@ import kotlin.reflect.jvm.jvmName
|
||||
|
||||
class DBViewer : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<DBViewer>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val webServer: Server
|
||||
|
@ -4,7 +4,7 @@ import com.google.common.util.concurrent.RateLimiter
|
||||
import net.corda.core.concurrent.CordaFuture
|
||||
import net.corda.core.internal.concurrent.openFuture
|
||||
import net.corda.core.internal.until
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.utilities.minutes
|
||||
import net.corda.demobench.model.NodeConfigWrapper
|
||||
import net.corda.demobench.readErrorLines
|
||||
@ -18,7 +18,7 @@ import kotlin.concurrent.thread
|
||||
|
||||
class WebServer internal constructor(private val webServerController: WebServerController) : AutoCloseable {
|
||||
private companion object {
|
||||
val log = loggerFor<WebServer>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
private val executor = Executors.newSingleThreadExecutor()
|
||||
|
@ -124,7 +124,7 @@ class ExplorerSimulation(private val options: OptionSet) {
|
||||
fun FlowHandle<AbstractCashFlow.Result>.log(seq: Int, name: String) {
|
||||
val out = "[$seq] $name $id :"
|
||||
returnValue.thenMatch({ (stx) ->
|
||||
Main.log.info("$out ${stx.id} ${(stx.tx.outputs.first().data as Cash.State).amount}")
|
||||
Main.log.info("$out ${stx.id} ${(stx.tx.outputs.first().data as Cash.State).amount}") // XXX: Why Main's log?
|
||||
}, {
|
||||
Main.log.info("$out ${it.message}")
|
||||
})
|
||||
|
@ -11,7 +11,7 @@ import jfxtras.resources.JFXtrasFontRoboto
|
||||
import joptsimple.OptionParser
|
||||
import net.corda.client.jfx.model.Models
|
||||
import net.corda.client.jfx.model.observableValue
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.explorer.model.CordaViewModel
|
||||
import net.corda.explorer.model.SettingsModel
|
||||
import net.corda.explorer.views.*
|
||||
@ -30,7 +30,7 @@ class Main : App(MainView::class) {
|
||||
private val fullscreen by observableValue(SettingsModel::fullscreenProperty)
|
||||
|
||||
companion object {
|
||||
val log = loggerFor<Main>()
|
||||
internal val log = contextLogger()
|
||||
}
|
||||
|
||||
override fun start(stage: Stage) {
|
||||
|
@ -8,12 +8,12 @@ import com.jcraft.jsch.agentproxy.AgentProxy
|
||||
import com.jcraft.jsch.agentproxy.connector.SSHAgentConnector
|
||||
import com.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.testing.driver.PortAllocation
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.*
|
||||
import kotlin.streams.toList
|
||||
|
||||
private val log = LoggerFactory.getLogger(ConnectionManager::class.java)
|
||||
private val log = loggerFor<ConnectionManager>()
|
||||
|
||||
/**
|
||||
* Creates a new [JSch] instance with identities loaded from the running SSH agent.
|
||||
|
@ -1,12 +1,13 @@
|
||||
package net.corda.loadtest
|
||||
|
||||
import net.corda.client.mock.*
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.*
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
private val log = LoggerFactory.getLogger(Disruption::class.java)
|
||||
private val log = loggerFor<Disruption>()
|
||||
|
||||
/**
|
||||
* A [Disruption] puts strain on the passed in node in some way. Each disruption runs in its own thread in a tight loop
|
||||
|
@ -2,15 +2,15 @@ package net.corda.loadtest
|
||||
|
||||
import com.google.common.util.concurrent.RateLimiter
|
||||
import net.corda.client.mock.Generator
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.toBase58String
|
||||
import net.corda.testing.driver.PortAllocation
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.*
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
private val log = LoggerFactory.getLogger(LoadTest::class.java)
|
||||
private val log = loggerFor<LoadTest<*, *>>()
|
||||
|
||||
/**
|
||||
* @param T The type of generated object in the load test. This should describe the basic unit of execution, for example
|
||||
|
@ -11,7 +11,7 @@ import net.corda.core.internal.concurrent.fork
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.nodeapi.internal.addShutdownHook
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.Closeable
|
||||
@ -27,7 +27,7 @@ import java.util.concurrent.ForkJoinPool
|
||||
*/
|
||||
class NodeConnection(val remoteNode: RemoteNode, private val jSchSession: Session, private val localTunnelAddress: NetworkHostAndPort) : Closeable {
|
||||
companion object {
|
||||
val log = loggerFor<NodeConnection>()
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -7,7 +7,6 @@ import net.corda.core.internal.concurrent.thenMatch
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.finance.USD
|
||||
import net.corda.finance.flows.CashExitFlow
|
||||
import net.corda.finance.flows.CashExitFlow.ExitRequest
|
||||
@ -16,10 +15,10 @@ import net.corda.finance.flows.CashIssueAndPaymentFlow.IssueAndPaymentRequest
|
||||
import net.corda.finance.flows.CashPaymentFlow
|
||||
import net.corda.finance.flows.CashPaymentFlow.PaymentRequest
|
||||
import net.corda.loadtest.LoadTest
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
object StabilityTest {
|
||||
private val log = loggerFor<StabilityTest>()
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
fun crossCashTest(replication: Int) = LoadTest<CrossCashCommand, Unit>(
|
||||
"Creating Cash transactions",
|
||||
generate = { _, _ ->
|
||||
|
@ -14,7 +14,7 @@ import net.corda.core.internal.div
|
||||
import net.corda.core.serialization.internal.nodeSerializationEnv
|
||||
import net.corda.core.transactions.LedgerTransaction
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.services.config.configureDevKeyAndTrustStores
|
||||
import net.corda.nodeapi.internal.ArtemisMessagingComponent.Companion.NODE_USER
|
||||
import net.corda.nodeapi.ArtemisTcpTransport
|
||||
@ -149,7 +149,7 @@ data class VerifierDriverDSL(
|
||||
val verifierCount = AtomicInteger(0)
|
||||
|
||||
companion object {
|
||||
private val log = loggerFor<VerifierDriverDSL>()
|
||||
private val log = contextLogger()
|
||||
fun createConfiguration(baseDirectory: Path, nodeHostAndPort: NetworkHostAndPort): Config {
|
||||
return ConfigFactory.parseMap(
|
||||
mapOf(
|
||||
|
@ -7,10 +7,7 @@ import net.corda.core.internal.div
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.internal.SerializationEnvironmentImpl
|
||||
import net.corda.core.serialization.internal.nodeSerializationEnv
|
||||
import net.corda.core.utilities.ByteSequence
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.debug
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.*
|
||||
import net.corda.nodeapi.ArtemisTcpTransport.Companion.tcpTransport
|
||||
import net.corda.nodeapi.ConnectionDirection
|
||||
import net.corda.nodeapi.VerifierApi
|
||||
@ -39,8 +36,7 @@ data class VerifierConfiguration(
|
||||
|
||||
class Verifier {
|
||||
companion object {
|
||||
private val log = loggerFor<Verifier>()
|
||||
|
||||
private val log = contextLogger()
|
||||
fun loadConfiguration(baseDirectory: Path, configPath: Path): VerifierConfiguration {
|
||||
val defaultConfig = ConfigFactory.parseResources("verifier-reference.conf", ConfigParseOptions.defaults().setAllowMissing(false))
|
||||
val customConfig = ConfigFactory.parseFile(configPath.toFile(), ConfigParseOptions.defaults().setAllowMissing(false))
|
||||
|
@ -75,7 +75,7 @@ data class CmdLineOptions(val baseDirectory: Path,
|
||||
.withFallback(appConfig)
|
||||
.withFallback(defaultConfig)
|
||||
.resolve()
|
||||
val log = loggerFor<CmdLineOptions>()
|
||||
val log = loggerFor<CmdLineOptions>() // I guess this is lazy so it happens after logging init.
|
||||
log.info("Config:\n${finalConfig.root().render(ConfigRenderOptions.defaults())}")
|
||||
return finalConfig
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import javax.ws.rs.ext.Provider
|
||||
@Provider
|
||||
class AllExceptionMapper : ExceptionMapper<Exception> {
|
||||
companion object {
|
||||
val logger = loggerFor<APIServerImpl>()
|
||||
private val logger = loggerFor<APIServerImpl>() // XXX: Really?
|
||||
}
|
||||
|
||||
override fun toResponse(exception: Exception?): Response {
|
||||
|
@ -4,7 +4,7 @@ import com.google.common.html.HtmlEscapers.htmlEscaper
|
||||
import net.corda.client.jackson.JacksonSupport
|
||||
import net.corda.client.rpc.CordaRPCClient
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.webserver.WebServerConfig
|
||||
import net.corda.webserver.converters.CordaConverterProvider
|
||||
import net.corda.webserver.services.WebServerPluginRegistry
|
||||
@ -32,7 +32,7 @@ import javax.ws.rs.core.MediaType
|
||||
|
||||
class NodeWebServer(val config: WebServerConfig) {
|
||||
private companion object {
|
||||
val log = loggerFor<NodeWebServer>()
|
||||
private val log = contextLogger()
|
||||
const val retryDelay = 1000L // Milliseconds
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.corda.webserver.servlets
|
||||
import net.corda.core.internal.extractFile
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.util.jar.JarInputStream
|
||||
@ -25,7 +25,9 @@ import javax.ws.rs.core.MediaType
|
||||
* TODO: Provide an endpoint that exposes attachment file listings, to make attachments browsable.
|
||||
*/
|
||||
class AttachmentDownloadServlet : HttpServlet() {
|
||||
private val log = loggerFor<AttachmentDownloadServlet>()
|
||||
companion object {
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun doGet(req: HttpServletRequest, resp: HttpServletResponse) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.corda.webserver.servlets
|
||||
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.utilities.loggerFor
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
@ -13,7 +13,9 @@ import javax.servlet.http.HttpServletResponse
|
||||
* Uploads to the node via the [CordaRPCOps] uploadFile interface.
|
||||
*/
|
||||
class DataUploadServlet : HttpServlet() {
|
||||
private val log = loggerFor<DataUploadServlet>()
|
||||
companion object {
|
||||
private val log = contextLogger()
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun doPost(req: HttpServletRequest, resp: HttpServletResponse) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user