Я помещаю ниже команду.
java -jar -Dlogging.config=C:\Users\P2932832\BPradhan\order-batch\order-batch\config\logback.xml order-batch-0.0.1-SNAPSHOT.jar --spring.config.location=C:\Users\P2932832\BPradhan\order-batch\order-batch\src\main\resources\application.yml
Тогда я могу видеть ниже журналы. Но когда пришло время записать остальные журналы в logs / order-batch.log, он ничего не делает. Но, если я использую STS, он работает отлично и записывает журнал в order-batch.log. Моим пользователям нужно запустить командную строку, поэтому будет полезно, если я увижу логи в order-batch.log
09:43:47,566 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.spectrum.sci] to DEBUG
09:43:47,569 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating DEBUG level on Logger[com.spectrum.sci] onto the JUL framework
09:43:47,572 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [httpclient] to WARN
09:43:47,576 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[httpclient] onto the JUL framework
09:43:47,576 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache] to WARN
09:43:47,576 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[org.apache] onto the JUL framework
09:43:47,576 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.context] to WARN
09:43:47,578 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[org.springframework.context] onto the JUL framework
09:43:47,579 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.core] to WARN
09:43:47,579 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[org.springframework.core] onto the JUL framework
09:43:47,580 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.beans] to WARN
09:43:47,580 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[org.springframework.beans] onto the JUL framework
09:43:47,581 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.web] to WARN
09:43:47,581 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating WARN level on Logger[org.springframework.web] onto the JUL framework
09:43:47,581 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.security] to DEBUG
09:43:47,583 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating DEBUG level on Logger[org.springframework.security] onto the JUL framework
09:43:47,585 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:43:47,591 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
09:43:47,637 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@787387795 - No compression will be used
09:43:47,645 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@787387795 - Will use the pattern logs/order-batch.%d{yyyy-MM-dd}.%i.log for the active file
09:43:47,651 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7907ec20 - The date pattern is 'yyyy-MM-dd' from file name pattern 'logs/order-batch.%d{yyyy-MM-dd}.%i.log'.
09:43:47,655 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7907ec20 - Roll-over at midnight.
09:43:47,665 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7907ec20 - Setting initial period to Fri Apr 10 09:38:51 MDT 2020
09:43:47,666 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7907ec20 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
09:43:47,669 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7907ec20 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy
09:43:47,673 |-WARN in Logger[org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator] - No appenders present in context [default] for logger [org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator].
09:43:47,675 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:43:47,705 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: logs/order-batch.log
09:43:47,707 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [logs/order-batch.log]
09:43:47,720 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
09:43:47,721 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@71f2a7d5 - Propagating INFO level on Logger[ROOT] onto the JUL framework
09:43:47,735 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
09:43:47,737 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:43:47,767 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@2aaf7cc2 - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.6.RELEASE)
Here is my application.yml
server:
port: 8080
osm.service.url: http://localhost:8090/order-manager/order
osm.service.username: TOS_Automation
osm.service.password: TOS_Automation$123
logging.config: config/logback.xml
Here is logback.xml
<configuration debug="true">
<!-- logger name="com.spectrum.sci" level="${log.level}" /-->
<logger name="com.spectrum.sci" level="INFO" />
<logger name="httpclient" level="WARN" />
<logger name="org.apache" level="WARN" />
<logger name="org.springframework.context" level="WARN" />
<logger name="org.springframework.core" level="WARN" />
<logger name="org.springframework.beans" level="WARN" />
<logger name="org.springframework.web" level="WARN" />
<logger name="org.springframework.batch" level="DEBUG" />
<logger name="org.springframework.security" level="DEBUG" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/order-batch.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/order-batch.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>5MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>[%d{YYYY-MM-dd HH:mm:ss.SSS}] [%level] [Context:%logger{0}] [%X] [%msg]%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="FILE" />
</root>
</configuration>