简体   繁体   English

无法关闭休眠信息记录

[英]Can't turn off hibernate info logging

i am using log4j and my configuration is as follows: 我正在使用log4j,我的配置如下:

log4j.rootLogger=OFF, stdout, rootLog
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.rootLog=org.apache.log4j.RollingFileAppender
log4j.appender.rootLog.File=${user.home}/logs/mylog.log
log4j.appender.rootLog.MaxFileSize=10000KB
log4j.appender.rootLog.MaxBackupIndex=3
log4j.appender.rootLog.layout=org.apache.log4j.PatternLayout
log4j.appender.rootLog.layout.ConversionPattern=%p %t %c - %m%n

# Control/Limit integrated frameworks logging messages

log4j.logger.org.hibernate=OFF
log4j.logger.org.springframework=OFF

although i am turning off the root logger and the hibernate logging 尽管我关闭了根记录器和休眠记录

i am still seeing info in the console from: 我仍然从以下位置在控制台中看到信息:

2099 [main] INFO org.hibernate.cfg.SettingsFactory
2440 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport
3239 [main] WARN org.hibernate.util.JDBCExceptionReporter

how to stop that, please advise, thanks. 如何停止,请告知,谢谢。

UPDATE: logging jars/dependencies: 更新:记录罐子/依赖项:

       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-simple</artifactId>
         <version>1.5.8</version>
        </dependency>



        <dependency>

            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
             <exclusion>
             <groupId>com.sun.jdmk</groupId>
             <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
             <groupId>com.sun.jmx</groupId>
             <artifactId>jmxri</artifactId>
            </exclusion>
          </exclusions>

        </dependency>

That's not really what your log4j config is. 这不是您的log4j配置真正的含义。 The output you've listed doesn't match either of the conversion patterns you showed in the config file. 您列出的输出与您在配置文件中显示的两种转换模式都不匹配。 It's using some other configuration. 它使用其他配置。

Update: Based on your updated question, if you're using an SLF4J Logger, then you aren't even using Log4J because you're using the slf4j-simple binding, which "outputs all events to System.err. Only messages of level INFO and higher are printed" per the SLF4J manual . 更新:根据更新的问题,如果您使用的是SLF4J Logger,那么您甚至都没有使用Log4J,因为您使用的是slf4j-simple绑定,该绑定“将所有事件输出到System.err。仅级别消息根据SLF4J手册打印INFO及更高版本。 To use Log4J, you have to use the slf4j-log4j12 binding. 要使用Log4J,必须使用slf4j-log4j12绑定。

You first need to find out which log4j config file it is using. 您首先需要找出它正在使用哪个log4j配置文件。 You can turn on debug on log4j, as a -D parameter when you run Java, and it will tell you. 您可以在运行Java时将log4j上的调试作为-D参数打开,它会告诉您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM