Spring boot 1.4 input to external tomcat

I am having problems deploying the w860 boot war file on an external tomcat. The problem is that I use the default entry i (just set the logging.file = custom.log property). It works well inside STS with built-in tomcat; however, when deployed to an external tomcat, a log file is not created.

Update: I added logback- spring.xml and works fine on the built-in tomcat, but not on the external one (it does not create the file)

+5
source share
2 answers

Here is the logback-spring.xml used in my project and it works well with external Tomcat.

 <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml"/> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="FILE"/> </root> </configuration> 

And in application.yml file:

 logging.file: "/var/logs/tomcat/application.log" 

===== Edited:

I would also use springProfile in the logback configuration to separate configurations for starting locally from starting in production; this way I can get the logs in the IDE console during development:

 <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml"/> <springProfile name="local"> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="CONSOLE"/> <appender-ref ref="FILE"/> </root> </springProfile> <springProfile name="prod"> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="FILE"/> </root> </springProfile> </configuration> 
0
source

You have completed the steps described in enter link description here , for example. Let your Application class extend SpringBootServletInitializer?

 @SpringBootApplication public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } 
0
source

Source: https://habr.com/ru/post/1261913/


All Articles