log4j HikariConfig调试消息日志4j

r55awzrz  于 2022-11-06  发布在  其他
关注(0)|答案(1)|浏览(274)

很长一段时间,我都在控制台中看到此消息

15:58:57.622 [main] DEBUG com.zaxxer.hikari.HikariConfig - ScraperPool - configuration:
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................true
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - 15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............10000
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
15:58:57.627 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>, prepStmtCacheSqlLimit=2048, cachePrepStmts=true, prepStmtCacheSize=250, leakDetectionThreshold=15000}
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName.................none
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName......none
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................10000
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
15:58:57.628 [main] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false

我试着用配置文件把它们隐藏起来,但没有成功,我找不到任何办法来隐藏这些信息。
这是我遇到问题的库;

<Logger name="org.openqa.selenium" level="ERROR" additivity="false">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="File"/>
        </Logger>

        <Logger name="org.apache.http" level="ERROR" additivity="false">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="File"/>
        </Logger>

        <Logger name="com.zaxxer.hikari.HikariConfig" level="info">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="File"/>
        </Logger>

        <logger name="org.hibernate">
            <level value="info"/>
        </logger>

我也遇到了同样的问题与其他库,例如Apache HTTP,它也打印了大量的调试和不必要的消息。
我正在寻找一个解决方案,谢谢。


# Root logger option

log4j.rootLogger=OFF
log4j.appender.console=org.apache.log4j.ConsoleAppender

log4j.logger.nz.ac.massey.cs.sdc.log4jassignment.s06005586.MemoryAppender = ERROR, MEMORY_APPENDER
log4j.additivity.nz.ac.massey.cs.sdc.log4jassignment.s06005586.MemoryAppender = false

# Direct log messages to a log file

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logs\\logging.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

# Direct log messages to stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

log4j.logger.org.hibernate=OFF
log4j.logger.org.openqa.selenium = SEVERE
log4j.logger.com.zaxxer.hikari.HikariConfig = OFF
uelo1irk

uelo1irk1#

如果您使用log4j2.properties,请定义每个套件的记录程式:

logger.hikari.name = com.zaxxer.hikari
logger.hikari.level = error

相关问题