Stop Spring Boot from Rolling Log files - spring

I've a simple spring boot application that generates about 10 lines of debug code every 24 hours however it seems that Spring Boot zips & rolls the default log file each day.
Is there any way to instruct Spring within application.properties (not via logback-spring.xml) to not not zip/roll the log and simply continue to use writing to the default log file.
I'm using Spring Boot 2.6.3

Related

Spring cloud config server not honoring logging.file property and not logging external file

I'm using spring-boot-starter 2.3.3.RELEASE version. I'm running my spring cloud configuration server in native profile (looking for configuration files in file system). I added
logging.file = /var/log/config.log in application.properties file. But my application is not logging logs to this file.(All other microservices are logging to this location). Am I missing any additional settings for Spring cloud config server? Thank you so much for your help.
In the spring boot 2.3.3 RELEASE documentation the logging properties that specify where the location should be is indicated using the property:
logging.file.path={path}
The documentation:
https://docs.spring.io/spring-boot/docs/2.3.3.RELEASE/reference/htmlsingle/#boot-features-logging-file-output
This modification from logging.path to logging.file.path appears as a deprecation in Spring Boot 2.2:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#deprecations-in-spring-boot-22
One way to do it with spring-boot application is, setting it from command line argument as default it will dump every thing on console.
logging.file=logs/test.log
Old school but far effective, save path in application.properties
logging.file=logs/test.log

How -Dlogging.level JVM argument is handled in spring boot, spring cloud

I have a spring cloud application, which under the covers uses spring boot.
In the bootstrap phase of the app I am using some classes from the apache commons config library under: org.apache.commons.configuration
My application is started with this flag per the spring docs:
-Dlogging.level.org.apache.commons.configuration=INFO
Despite this, i am still getting DEBUG level logs emitted during the bootstrap phase of spring....
I am lost as to how to properly specify the log level of INFO specified for the bootstrap phase of spring boot.
Ensure you are not setting debug=true in application properties or not passing --debug flag to the application.
In application.properties set:
debug=false
The configuration of spring boot has a specific order, so probably somewhere in the application or bootstrap configuration files the logging level is configured to DEBUG.
Source:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

Spring Boot 2.0.0.M6 and file upload more than 10 MB

To my Spring Boot 2.0.0.M6 application.properties I have added the following lines:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB
but when I try to upload to my RestController the 21MB file it fails with the following exception:
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21112803) exceeds the configured maximum (10485760)
I run my application on Embedded Tomcat packaged with Spring Boot.
How to properly configure my application in order to allow file upload up to 100MB?
As shown in the documentation, and in its appendix, the correct properties are spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size.
For SpringBoot 1.5.7 till or before 2.1.2 the property need to set in application.properties file are:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB
Also make sure you have application.properties file in "resources" folder. In case you are not sure with the size then "-1" is the value.
spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=1000MB
spring.http.multipart.max-file-size=50MB
spring.http.multipart.max-request-size=50MB
Above both the way not working in my version(1.3.4) also,
So that i used following way and it's working,
multipart.enabled=true
multipart.max-file-size=100MB
multipart.max-request-size=100MB
For Spring boot version 2.4.3 and after this version use this
spring.servlet.multipart.max-file-size=-1 spring.servlet.multipart.max-request-size=-1

Spring batch admin upgrade

I am working on a application to upgrade it to JAVA 8.
It is using spring integration, spring batch and spring batch admin.
For spring integration and spring batch to work on java 8, we have to upgrade it to latest spring integration which is 4.3.5 (this is what I'm trying to use) and spring batch to 3.0.7.
Problem I am facing is while upgrading SPRING BATCH ADMIN, which was last released in jan 2015 and internally it uses old spring integration version.
Wanted to ask- what are my options as application is very much depending on spring batch admin?
Is there any alternative for spring batch admin which can be used with spring integration 4.3.5 and spring batch 3.0.7.
Need advice and help regarding the same.
Note: I have read somewhere that I can use spring boot admin.
Please let me know if need more clarification on above question.
.
Spring Batch Admin project is deprecated. There won't be 2.0.0 release.
Spring Cloud Data Flow isn't direct alternative to Spring Batch Admin. It is about orchestration of processes in cloud environment while Spring Batch Admin is a dashboard for BATCH_ tables, though this functionality is present in Data Flow in its own way ))
UPDATE If you are in 2022, check this de.codecentric:batch-web-spring-boot-starter:
https://github.com/codecentric/spring-boot-starter-batch-web
https://blog.codecentric.de/batch-web-spring-boot-starter-2-0-1-released
https://mvnrepository.com/artifact/de.codecentric/batch-web-spring-boot-starter
This is a fork of spring-batch-admin that might be useful...
https://github.com/httpants/spring-batch-admin

How to set the logging level of embedded tomcat in Spring Boot?

How to set the logging level of embedded tomcat in Spring Boot?
Especially I need to see the tomcat clustering-related logs.
I added the following line to the application.properties, but tomcat seems to log only INFO level logs.
logging.level.org.apache.catalina=TRACE
Is there a simple method to accomplish this?
It would be best to know the Spring Boot and embedded tomcat-specific, simple solution, preferably only editing application.properties.
In short, use Spring Boot version 1.3.0 with Logback. (I was using Spring Boot 1.2.4)
Spring Boot 1.3.0 adds LevelChangePropagator to LogbackLoggingSystem.java (see this commit), thus the logging level that is set in application.properties is propagated to the jul(java.util.logging) which tomcat uses.
Otherwise, one must set the logging level for the logger in the logging.properties for the jul if the level is below the INFO level which is the default, AND also set the logging level for the logger in the application.properties. This is for the limitation of jul-to-slf4j module which cannot completely override jul implementation since jul is in the java.* package.
Also see the following Spring Boot issues: Optimize JUL logging #2585, Slf4JLoggingSystem should also configure JUL levels #2923.
And this is the related StackOverflow question: Spring Boot - set logging level of external jar which is using Java Util Logging (jul). Actually this is the problem I was facing.
(I will accept this answer if no better answer is posted for a few days from now.)

Resources