NutzCN Logo
问答 [NutzDao]求教如何在springboot中,让NutzDao不输出或调整输出级别。
发布于 219天前 作者 wx_nlugjssocpkj3bf8bamd 508 次浏览 复制 上一个帖子 下一个帖子
标签:

启动代码如下:其中一些查询详细字段换成了"*"

      +++++   +++++++++                 
      ++++++++++++++++++++              
         +++++++++++++++++++            
       +++++++++++++++I7+++++           
       +++++++++++++++~ =++=            
      ++++++++++++++ ~7=.====           
     ++++++++++++++I~~ ~======          
     +++++++++++++ ~~~:========         
     ++++++++++++ ~~~~~~~======         
     ++++++++++: ~~~~~~~~:~=====        
     +++++++ == ~=++~~~=:~======        
      ++++ ======~~ ~~?:~=======        
       + ==========7~~:~========        
          ========7~I:~=========        
            ====== ~:~==========        
             ======~~==========         
                ===============         
                   ===========          
                                        
                                        
                                          				
'  ███╗   ██╗██╗   ██╗████████╗███████╗     ███████╗████████╗ █████╗ ██████╗ ████████╗███████╗██████╗ 
'  ████╗  ██║██║   ██║╚══██╔══╝╚══███╔╝     ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
'  ██╔██╗ ██║██║   ██║   ██║     ███╔╝█████╗███████╗   ██║   ███████║██████╔╝   ██║   █████╗  ██████╔╝
'  ██║╚██╗██║██║   ██║   ██║    ███╔╝ ╚════╝╚════██║   ██║   ██╔══██║██╔══██╗   ██║   ██╔══╝  ██╔══██╗
'  ██║ ╚████║╚██████╔╝   ██║   ███████╗     ███████║   ██║   ██║  ██║██║  ██║   ██║   ███████╗██║  ██║
'  ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚══════╝     ╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝  ╚═╝
'                                                                                                     
 
 
 					powered by nutz.cn  version 1.r.65

2019-04-09 07:04:18.796  INFO 17137 --- [  restartedMain] c.c.o.OnlineFreeSmsApplication           : Starting OnlineFreeSmsApplication on wangchaodeMacBook-Pro.local with PID 17137 (/Users/wangchao/java-work/online-free-sms/target/classes started by wangchao in /Users/wangchao/java-work/online-free-sms)
2019-04-09 07:04:18.799  INFO 17137 --- [  restartedMain] c.c.o.OnlineFreeSmsApplication           : The following profiles are active: dev
2019-04-09 07:04:18.841  INFO 17137 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-04-09 07:04:19.543  INFO 17137 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-04-09 07:04:19.545  INFO 17137 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-04-09 07:04:19.572  INFO 17137 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 repository interfaces.
2019-04-09 07:04:19.914  INFO 17137 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8b351f3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-09 07:04:20.110  INFO 17137 --- [  restartedMain] org.xnio                                 : XNIO version 3.3.8.Final
2019-04-09 07:04:20.122  INFO 17137 --- [  restartedMain] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2019-04-09 07:04:20.233  WARN 17137 --- [  restartedMain] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2019-04-09 07:04:20.254  INFO 17137 --- [  restartedMain] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext
2019-04-09 07:04:20.254  INFO 17137 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1413 ms
19-04-09 07:04:20.383 INFO [restartedMain] Select SystemLog as Nutz.Log implement
19-04-09 07:04:20.496 DEBUG [restartedMain] Locations count=129 time use 102ms
19-04-09 07:04:20.746 DEBUG [restartedMain] Using 101 castor for Castors
19-04-09 07:04:20.820 DEBUG [restartedMain] Jdbcs init complete
19-04-09 07:04:20.820 INFO [restartedMain] Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2019-04-09 07:04:20.821  INFO 17137 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-04-09 07:04:20.953  INFO 17137 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
19-04-09 07:04:20.961 DEBUG [restartedMain] select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
19-04-09 07:04:20.964 DEBUG [restartedMain] JDBC Driver --> mysql-connector-java-8.0.15 (Revision: 79a4336f140499bd22dd07f02b708e163844e3d5)
19-04-09 07:04:20.964 DEBUG [restartedMain] JDBC Name   --> MySQL Connector/J
19-04-09 07:04:20.965 DEBUG [restartedMain] JDBC URL    --> jdbc:mysql://10.0.0.254/sms-record?useSSL=false
19-04-09 07:04:20.985 DEBUG [restartedMain] Mysql : character_set_client=utf8mb4
19-04-09 07:04:20.986 DEBUG [restartedMain] Mysql : character_set_connection=utf8mb4
19-04-09 07:04:20.986 DEBUG [restartedMain] Mysql : character_set_database=utf8mb4
19-04-09 07:04:20.986 DEBUG [restartedMain] Mysql : character_set_filesystem=binary
19-04-09 07:04:20.986 DEBUG [restartedMain] Mysql : character_set_results=
19-04-09 07:04:20.986 DEBUG [restartedMain] Mysql : character_set_server=utf8mb4
19-04-09 07:04:20.987 DEBUG [restartedMain] Mysql : character_set_system=utf8
19-04-09 07:04:20.987 DEBUG [restartedMain] Mysql : character_sets_dir=/usr/local/mysql/share/charsets/
19-04-09 07:04:20.990 DEBUG [restartedMain] Mysql : binlog_format=MIXED
19-04-09 07:04:20.991 DEBUG [restartedMain] Mysql : database=sms-record
19-04-09 07:04:20.992 DEBUG [restartedMain] Mysql : user=root@10.0.0.113
19-04-09 07:04:21.005 DEBUG [restartedMain] Database info --> MYSQL:[MySQL - 5.7.22-log]
19-04-09 07:04:21.016 DEBUG [restartedMain] Found 2 resource by src( sqls ) , regex( .(sql|sqlx|sqls)$ )
19-04-09 07:04:21.016 DEBUG [restartedMain] load >> index.sql from root=sqls
19-04-09 07:04:21.017 DEBUG [restartedMain] key=[index.selectPhones], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.017 DEBUG [restartedMain] key=[index.findMobileNumber], sql=[SELECT
*
LIMIT 1;]
19-04-09 07:04:21.018 DEBUG [restartedMain] key=[index.selectReceiveSmsRecord], sql=[SELECT
*
LIMIT @pageNumber,@pageSize;]
19-04-09 07:04:21.018 DEBUG [restartedMain] key=[index.selectNotices], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.018 DEBUG [restartedMain] key=[index.findArticle], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.018 DEBUG [restartedMain] key=[index.selectAllArticles], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.018 DEBUG [restartedMain] key=[index.selectAllCountrys], sql=[SELECT
*
ORDER BY c.id DESC;]
19-04-09 07:04:21.019 DEBUG [restartedMain] key=[index.selectAllMobiles], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.019 DEBUG [restartedMain] key=[index.selectModempoolMobiles], sql=[SELECT
*
pi.Id DESC;]
19-04-09 07:04:21.019 DEBUG [restartedMain] key=[index.selectMobileSmsRecord], sql=[SELECT
*
ss.Id DESC;]
19-04-09 07:04:21.019 DEBUG [restartedMain] key=[index.selectAllInvalidMobileNumbers], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.019 DEBUG [restartedMain] load 11 sql >> index.sql from root=sqls
19-04-09 07:04:21.020 DEBUG [restartedMain] load >> index.sql from root=sqls
19-04-09 07:04:21.020 DEBUG [restartedMain] key=[index.selectPhones], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.020 DEBUG [restartedMain] key=[index.findMobileNumber], sql=[SELECT
*
LIMIT 1;]
19-04-09 07:04:21.020 DEBUG [restartedMain] key=[index.selectReceiveSmsRecord], sql=[SELECT
*
LIMIT @pageNumber,@pageSize;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.selectNotices], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.findArticle], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.selectAllArticles], sql=[SELECT
*
a.`timestamp` DESC;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.selectAllCountrys], sql=[SELECT
*
ORDER BY c.id DESC;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.selectAllMobiles], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.021 DEBUG [restartedMain] key=[index.selectModempoolMobiles], sql=[SELECT
*
pi.Id DESC;]
19-04-09 07:04:21.022 DEBUG [restartedMain] key=[index.selectMobileSmsRecord], sql=[SELECT
*
ss.Id DESC;]
19-04-09 07:04:21.022 DEBUG [restartedMain] key=[index.selectAllInvalidMobileNumbers], sql=[SELECT
*
p.id DESC;]
19-04-09 07:04:21.022 DEBUG [restartedMain] load 0 sql >> index.sql from root=sqls
19-04-09 07:04:21.022 DEBUG [restartedMain] SqlManager Sql count=11
2019-04-09 07:04:21.387  INFO 17137 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-04-09 07:04:21.534  INFO 17137 --- [  restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2019-04-09 07:04:21.752  INFO 17137 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2019-04-09 07:04:21.798  WARN 17137 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : Unable to start LiveReload server
2019-04-09 07:04:21.889  INFO 17137 --- [  restartedMain] o.s.b.w.e.u.UndertowServletWebServer     : Undertow started on port(s) 8892 (http) with context path ''
2019-04-09 07:04:21.892  INFO 17137 --- [  restartedMain] c.c.o.OnlineFreeSmsApplication           : Started OnlineFreeSmsApplication in 3.745 seconds (JVM running for 4.583)

Logback配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" scanPeriod="30 seconds">
    <include resource="org/springframework/boot/logging/logback/base.xml"/>

    <property name="LOG_HOME" value="/home/website/logs" />

    <appender name="FILE_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">

        <file>${LOG_HOME}/access.log</file>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%msg%n</Pattern>
        </encoder>

        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- rollover daily -->
            <fileNamePattern>${LOG_HOME}/archived/access.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>20MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>7</maxHistory>
            <totalSizeCap>2GB</totalSizeCap>
        </rollingPolicy>

    </appender>

    <logger name="org.nutz.dao" additivity="false">
        <level value="INFO" />
        <appender-ref ref="FILE_LOG" />
    </logger>

    <logger name="rs.access" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="CONSOLE" />
    </logger>
    
</configuration>

小白求助,缺少代码的话可以继续提供。谢谢各位。

5 回复

说的是打印的那些自定义sql? 改改日志级别,不打印就是了

index.sql from root=sqls
19-04-09 07:30:32.003 DEBUG [restartedMain] key=[index.selectNotices], sql=[SELECT
a.*
FROM
article AS a
WHERE
a.`language`=@language AND a.`publish_status`=1
ORDER BY
a.`timestamp` DESC;]
19-04-09 07:30:32.004 DEBUG [restartedMain] key=[index.findArticle], sql=[SELECT
a.*
FROM
article AS a
WHERE
a.`id`=@articleId AND a.`publish_status`=1
ORDER BY
a.`timestamp` DESC;]

会打印这些sql,我设置成INFO的话,这些日志还是被打印出来,不知道是那里配置的不对,所以请大佬给看下

<logger name="org.nutz.dao" additivity="false">
        <level value="INFO" />
        <appender-ref ref="CONSOLE" />
    </logger>

@大鲨鱼(Wizzercn)
谢谢提供答案,但是我的logback配置文件里面已经写上这个了。。。没有用。

是你的logback配置整个就没生效吧

添加回复
请先登陆
回到顶部