Feature/reduce logging (#1667)

* Reduce Hikari related logging

* Reduce WebView related logging
This commit is contained in:
schroda
2025-09-25 00:01:23 +02:00
committed by GitHub
parent d95f4fe1e1
commit cdb98d2175
4 changed files with 10 additions and 11 deletions

View File

@@ -135,7 +135,7 @@ class KcefWebView {
ConsoleEvent(level.ordinal, message, source, line), ConsoleEvent(level.ordinal, message, source, line),
), ),
) )
logger.debug { "$source:$line: $message" } logger.trace { "$source:$line: $message" }
return true return true
} }
@@ -173,7 +173,7 @@ class KcefWebView {
frame: CefFrame, frame: CefFrame,
httpStatusCode: Int, httpStatusCode: Int,
) { ) {
logger.info { "Load event: ${frame.name} - ${frame.url}" } logger.trace { "Load event: ${frame.name} - ${frame.url}" }
if (httpStatusCode > 0 && frame.isMain) handleLoad(frame.url, httpStatusCode) if (httpStatusCode > 0 && frame.isMain) handleLoad(frame.url, httpStatusCode)
flush() flush()
} }
@@ -199,7 +199,7 @@ class KcefWebView {
requestInitiator: String, requestInitiator: String,
disableDefaultHandling: BoolRef, disableDefaultHandling: BoolRef,
): CefResourceRequestHandler? { ): CefResourceRequestHandler? {
logger.info { "Load resource: ${frame.name} - ${request.url}" } logger.trace { "Load resource: ${frame.name} - ${request.url}" }
return null return null
} }
} }
@@ -253,7 +253,7 @@ class KcefWebView {
addRequestHandler(RequestHandler()) addRequestHandler(RequestHandler())
} }
logger.info { "Start loading cookies" } logger.debug { "Start loading cookies" }
CefCookieManager.getGlobalManager().apply { CefCookieManager.getGlobalManager().apply {
val cookies = networkHelper.cookieStore.getStoredCookies() val cookies = networkHelper.cookieStore.getStoredCookies()
for (cookie in cookies) { for (cookie in cookies) {
@@ -307,7 +307,7 @@ class KcefWebView {
private fun flush() { private fun flush() {
if (browser == null) return if (browser == null) return
logger.info { "Start cookie flush" } logger.trace { "Start cookie flush" }
CefCookieManager.getGlobalManager().visitAllCookies { it, _, _, _ -> CefCookieManager.getGlobalManager().visitAllCookies { it, _, _, _ ->
try { try {
networkHelper.cookieStore.addAll( networkHelper.cookieStore.addAll(
@@ -631,7 +631,7 @@ class KcefWebView {
error: String? = null, error: String? = null,
) { ) {
browser!!.evaluateJavaScript("return document.title") { browser!!.evaluateJavaScript("return document.title") {
logger.info { "Load finished with title $it" } logger.trace { "Load finished with title $it" }
WebView.notifyAllClients( WebView.notifyAllClients(
Json.encodeToString<Event>( Json.encodeToString<Event>(
LoadEvent(url, it ?: "", status, error), LoadEvent(url, it ?: "", status, error),

View File

@@ -102,11 +102,10 @@ object WebView : Websocket<String>() {
val url = event.url val url = event.url
dr.loadUrl(url) dr.loadUrl(url)
dr.resize(event.width, event.height) dr.resize(event.width, event.height)
logger.info { "Loading URL $url" } logger.debug { "Loading URL $url" }
} }
is ResizeMessage -> { is ResizeMessage -> {
dr.resize(event.width, event.height) dr.resize(event.width, event.height)
logger.info { "Resize browser" }
} }
is JsEventMessage -> { is JsEventMessage -> {
dr.event(event) dr.event(event)

View File

@@ -437,8 +437,8 @@ fun applicationSetup() {
runMigrations(applicationDirs) runMigrations(applicationDirs)
// Disable jetty's logging
setLogLevelFor("org.eclipse.jetty", Level.OFF) setLogLevelFor("org.eclipse.jetty", Level.OFF)
setLogLevelFor("com.zaxxer.hikari", Level.WARN)
// socks proxy settings // socks proxy settings
serverConfig.subscribeTo( serverConfig.subscribeTo(

View File

@@ -133,13 +133,13 @@ fun databaseUp() {
// Log pool statistics // Log pool statistics
DBManager.getPoolStats()?.let { stats -> DBManager.getPoolStats()?.let { stats ->
logger.info { "HikariCP initialized: $stats" } logger.debug { "HikariCP initialized: $stats" }
} }
// Add shutdown hook to properly close HikariCP pool // Add shutdown hook to properly close HikariCP pool
Runtime.getRuntime().addShutdownHook( Runtime.getRuntime().addShutdownHook(
Thread { Thread {
logger.info { "Shutting down HikariCP connection pool..." } logger.debug { "Shutting down HikariCP connection pool..." }
DBManager.shutdown() DBManager.shutdown()
}, },
) )