近期一直在忙项目上的事情,今天对以前的工作做一个简单的小结。明天就是国庆节啦。

 

1  脚本可以手动执行,可是crontab缺总是找不到路径?

#!/bin/bash
. /etc/profile . /home/sms/.bash_profile

请在脚本中加入 本机的环境变量和用户的环境变量的配置

 

2 config.ini文件总是出现乱码,导致读入的数据莫名其妙?

更改config的编码为ANSI, UTF-8不一定是更好的选择。

 

3 logback.xml配置不起作用

可能是pom文件引入jar文件相互之间有屏蔽的影响。把logback依赖的文件放入到前面试试。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="FILE-THREAD" class="ch.qos.logback.classic.sift.SiftingAppender">
        <discriminator>
            <key>logname</key>
            <defaultValue>rdjklog</defaultValue>
        </discriminator>
        <sift>
            <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <file>${logname}.log</file>

                <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
                    <fileNamePattern>${logname}.log.%i</fileNamePattern>
                    <minIndex>1</minIndex>
                    <maxIndex>10</maxIndex>
                </rollingPolicy>

                <triggeringPolicy
                        class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                    <maxFileSize>10MB</maxFileSize>
                </triggeringPolicy>

                <!-- encoders are assigned the type
             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
                <encoder>
                    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
                </encoder>
            </appender>

        </sift>
    </appender>

    <root level="debug">
        <appender-ref ref="FILE-THREAD"/>
    </root>
</configuration>
logback文件-样例

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2021-10-16
  • 2021-11-26
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2021-09-10
  • 2021-12-04
  • 2022-03-01
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案