我正在使用Spring Boot和Logback。我可以使用IDE(IntelliJ)登录到本地环境中的文件,但是无法使用JBoss EAP 7.1登录AWS EC2 redhat linux。创建日志文件权限后,我尝试将其设置为777
,但仍然无法正常工作。我启动服务器的方式是
sudo sh /home/ec2-user/jboss-eap-7.1/bin/standalone.sh
我的logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--Local-->
<!--<property name="LOG_FOLDER" value="${user.dir}/log" />-->
<!--Server-->
<property name="LOG_FOLDER" value="/home/ec2-user/jboss-eap-7.1/applications/springboottest/log"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>[%d{HH:mm:ss.SSS}] THREAD=[%6.-6X{threadID}] %-5level [%30.-30logger{0}] - %msg%n</Pattern>
</layout>
</appender>
<appender name="ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FOLDER}/log.all.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>[%d{HH:mm:ss.SSS}] THREAD=[%6.-6X{threadID}] %-5level [%30.-30logger{0}] - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ALL"/>
</root>
</configuration>
有人知道为什么它不能追加到文件吗?
感谢您的帮助。谢谢