SpringBoot 2.4.0, no log file written (logging.file.name) - spring-boot

I tried to use logging.file.name=springboot.log to set my log file, but no log file would written. But it's very confusing that springboot.txt works. This following is my settings in application.properties:
logging.level.com.demo=trace
# For the following files, I just keep one and comment the others
logging.file.name=springboot.yml # Works
logging.file.name=springboot.xml # Works
logging.file.name=springboot.txt # Works
logging.file.name=springboot.log # Does not work
logging.file.name=logging/springboot.yml # Works
logging.file.name=logging/springboot.log # Does not work

I have just upgraded the dependencies a springboot application that uses multiple profiles and hit a similar issue - for me it works, but fails to work if profiles are involved.
logging.file.name which has been running for at least 6 months now without problems suddenly stopped working after dependency upgrade from 2.3.8 -> 2.4.2.
Thus think looks like a 2.4 issue.
For a temporary fix you could try downgrading - in gradle the following works for me:
plugins
{
id 'com.github.ben-manes.versions' version '0.36.0'
id 'org.springframework.boot' version '2.3.8.RELEASE'
}
Having done some further investigation it appears to fail for me because of overrides in the profiles.
So I have two profiles: base and dev which are used together --spring.profiles.active=base,dev
My base sets logging.file.name for the default live. my dev profile overrides this and sets it to ./blah.log.
For me that is not picked up under 2.4.2 and fails, but overrides correctly with 2.3.8.
If you are using multiple profiles this may be the problem.
EDIT: I've raised a big report on Spring Boot on github: https://github.com/spring-projects/spring-boot/issues/25058

Related

Gradle Version and DockerFile

In our Pipeline I have a surprising situation. If I using Gradle 6.8.x and higher a COPY *.jar to /opt/file.jar inside an unchanged Dockerfile did not work with:
Step 21/33 : COPY *.jar /opt/file.jar
When using COPY with more than one source file, the destination must be a directory and end with a /
Using Gradle with version 6.5.x and early it works.
Which different behavore has Gradle with 6.8.x and higher, which ends in conflicts with a Dockerfile and how can I solve this?
Thx in advance
Not sure if this helps, but I had the same problem (updating from Gradle 6.5 to 7.3), and also simultaneously updating from Spring Boot 2.4 to 2.6, which was actually my problem.
Spring Boot starts to create plain.jar by default next to your jar (documentation) since version 2.5.0, so in my build folder were actually 2 *.jar files and the COPY error was correct.
How to disable creation of plain.jar file is answered here
If this is not your case, please check what actually gets created in your build folder and if there are multiple files.

Flyway wildcard is not working in Spring Boot

I get the following error:
Flyway failed to initialize: none of the following migration scripts locations could be found:
- classpath:db/*/migrations/
This is what the directory structure looks like:
And this is what I've tried:
# examples, obviously I tried these independently from each other
spring:
flyway:
# these work:
locations: "classpath:db"
locations: "classpath:db/release_1.0/migrations/"
# these don't work: (I am getting the same error as shown above)
locations: "classpath:db/**/migrations/"
locations: "classpath:db/release*/migrations/"
locations: "classpath:db/*/migrations/"
But they should work according to this blogpost from version 6.4. (I don't see it documented that they have removed it)
I am using spring-boot-starter-parent 2.4.1, so it is Flyway 7.1.1.
Can anyone explain to me how to specify the migrations folder using a wildcard in Flyway and why is it not working?
As Flyway's location support has grown to support wildcards, cloud storage, etc., Spring Boot's ability to accurately check the locations has decreased as described in this issue. As a result, support for location checking was deprecated in Spring Boot 2.5 and, after the deprecation period, it will be removed entirely. In the meantime, you can switch it off by setting spring.flyway.check-location to false.

Spring Application won't start: jaxb-impl-2.2.3-1.jar referenced one or more files that do not exist:

I'm stuck behind this error in IDEA. I was working as usual debugging some classes and everything was working just fine. But at a given moment my spring application stopped initializing and this line appear on the console every time now, and the application remains in a infinite loop, trying to initialize:
The Class-Path manifest attribute in /home/user/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar referenced one or more files that do not exist: file:/home/user/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-api.jar,file:/home/user/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/activation.jar,file:/home/user/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.3/jsr173_1.0_api.jar,file:/home/user/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb1-impl.jar
And these lines :
project: 1.1.0-iron-man-SNAPSHOT
Spring Boot version: (v1.5.10.RELEASE)
Java Version: 1.8.0_141
Source Encoding: UTF-8
turned out to this:
project: #project.version#
Spring Boot version: (v1.5.10.RELEASE)
Java Version: #java.version#
Source Encoding: #project.build.sourceEncoding#
I'm didn't change any config files in the project.
I have tried mvn clean install.
I have tried to force IDEA to read the maven dependecies again.
None of them have worked.
Maybe File -> Invalidate Caches / Restart helps
First Picture MANIFEST.MF defines the classpath
But they are stored in different maven repository forlders

Is SpringSource Tool Suite 2.6 Grails support broken?

I have recently updated my STS from 2.5.2 to 2.6. Since then, each grails project shows an error in the conf/spring/resources.groovy file reading: Description Resource Path Location Type
Internal compiler error: java.lang.VerifyError: (class: org/codehaus/jdt/groovy/internal/compiler/ast/JDTClassNode, method: initialize signature: ()V) Bad access to protected data at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.createClassNode(JDTResolver.java:461) resources.groovy /GrailsProject/grails-app/conf/spring line 0 Java Problem
The resources.groovy file is as good as empty (in default state), and if I delete it, the error is shown on the DataSource.groovy, so the file itself seems not to be the cause.The used groovy compiler version is 1.7.3.I have made a clean STS 2.6 install, installed the groovy and grails plugins and got the same error.What could be the problem? And is there a solution to this not resulting in downgrading to 2.5.2 again? Thank you
Take a look at your preferences Groovy -> Compiler. Are you by any chance accidentally using Groovy 1.6?
EDIT
That didn't solve the problem, but as described in http://forum.springframework.org/showthread.php?p=357361, upgrade to the latest dev build of Groovy-Eclipse as well as Grails Tooling and that should work.

How do I set where my grails plugins should be installed?

I saw the light and install the joda-time plugin for grails.
However, when I tried to commit my changes to source control I realised that grails had located the files in:
C:\Users\Steve\.grails\1.1.1\plugins
instead of somewhere under the project directory of:
f:\grails\projects\myproject
Yeah I'm using windows :-\
So now when someone pulls down my changes from source control they are missing all the joda-time plugin lovelyness and they are wanting to spank me :)
What should I be setting so that grails doesn't put anything under my user directory?
(It isn't installed as a global plugin - just as a project one - at least I think so, I ran "grails install-plugin joda-time" )
Many thanks in advance.
P.S. Currently listening to Plug In Baby by Muse....how coincidental :D
The plugin is listed in application.properties, so when someone gets your code Grails will install missing plugins the first time they run 'grails run-app' or other commands.
If you want to revert to 1.0.x behavior just create grails-app/conf/BuildConfig.groovy with the line
grails.project.plugins.dir='plugins'
and your plugins will be in with the rest of the project files.

Resources