Log module configuration


Log module initialization parameters, add the following configuration items to the ymp-conf.properties file as needed, otherwise the module will use the default configuration for initialization:

  #-------------------------------------
  # 日志模块初始化参数
  #-------------------------------------

  # 日志记录器配置文件,默认为${root}/cfgs/log4j.xml,变量${user.dir}的取值结果将受配置体系模块影响
  ymp.configs.log.config_file=

  # 日志文件输出路径,默认为${root}/logs/
  ymp.configs.log.output_dir=

  # 日志记录器默认名称,默认为default
  ymp.configs.log.logger_name=

  # 日志记录器接口实现类,默认为net.ymate.platform.log.impl.DefaultLogger
  ymp.configs.log.logger_class=

  # 默认日志记录器是否允许控制台输出,默认为false
  ymp.configs.log.allow_output_console=

Note: You need to pay attention to whether the log4j.xml file configured in config_file exists, and whether the output path specified in output_dir Correct and effective, these two configurations will affect the exception when the YMP framework starts;

In addition, it is recommended to set the allow_output_console parameter to true during the development stage, so that the log output can be viewed directly through the console;

Log4J configuration file, the content is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration>
        <Appenders>
            <RollingFile name="default" fileName="${sys:LOG_OUT_DIR}/default.log"
                         filePattern="${sys:LOG_OUT_DIR}/$${date:yyyy-MM}/default-%d{MM-dd-yyyy}-%i.log.gz">
                <PatternLayout pattern="%m %n" charset="UTF-8"/>
                <SizeBasedTriggeringPolicy size="500 MB"/>
            </RollingFile>
            <!--
            <RollingFile name="custom-logname" fileName="${sys:LOG_OUT_DIR}/custom-logname.log"
                         filePattern="${sys:LOG_OUT_DIR}/$${date:yyyy-MM}/custom-logname-%d{MM-dd-yyyy}-%i.log.gz">
                <PatternLayout pattern="%m %n" charset="UTF-8"/>
                <SizeBasedTriggeringPolicy size="500 MB"/>
            </RollingFile>
            -->
        </Appenders>
        <Loggers>
            <!--
            <Logger name="custom-logname" level="debug">
                <AppenderRef ref="custom-logname"/>
            </Logger>
            -->
            <!-- 配置记录器级别 -->
            <Root level="debug">
                <!-- 输出设置 -->
                <AppenderRef ref="default"/>
            </Root>
        </Loggers>
    </Configuration>

**注**:该文件应根据ymp.configs.log.config_file指定的位置,其内容请根据实际情况调整。