-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using Logback, log messages appear in a single line when application name contains brackets #39564
Comments
Thanks for reporting this, @moonlight200. As far as I can tell, Logback does not support escaping of the characters that have special meaning to its support for variable substitution. This means that we'd have to replace the problematic characters ( |
I wonder if we could put the application name in a logback variable then use |
Thank you for the quick replies. From what I could see in the |
@moonlight200 Out of interest, does setting |
We're considering failing fast with an exception then giving users the choice of either changing their application name or disabling the feature. |
With this config:
Logging works fine:
|
The problem doesn't occur with Log4j2. With that in mind, this branch contains a fix that's Logback-specific. The fix uses An alternative to this would be to use a custom converter for the logged application name, similar to what we're already doing for the correlation ID. |
We're going to look at a custom converter because we're worried about regex performance. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [nu.ndw.nls.geometry:nls-geometry](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `3.2.0` -> `3.2.4` | | [commons-io:commons-io](https://commons.apache.org/proper/commons-io/) ([source](https://gitbox.apache.org/repos/asf?p=commons-io.git)) | compile | minor | `2.17.0` -> `2.18.0` | | [org.springframework.boot:spring-boot-starter-parent](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | parent | minor | `3.3.5` -> `3.4.0` | --- ### Release Notes <details> <summary>spring-projects/spring-boot (nu.ndw.nls.geometry:nls-geometry)</summary> ### [`v3.2.4`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.4) [Compare Source](spring-projects/spring-boot@v3.2.3...v3.2.4) #### ⭐ New Features - Add TWENTY_TWO to JavaVersion enum [#​39825](spring-projects/spring-boot#39825) #### 🐞 Bug Fixes - Thread name prefix is not always set when using virtual threads [#​39958](spring-projects/spring-boot#39958) - spring-boot-maven-plugin doesn't work with Java 22 [#​39927](spring-projects/spring-boot#39927) - Resolving a BuildpackReference created from a URL-like String can fail on Windows [#​39793](spring-projects/spring-boot#39793) - SpringProfile arbiter fails without a Spring's environment [#​39786](spring-projects/spring-boot#39786) - bootStartScripts tasks should be an instance of org.gradle.api.tasks.application.CreateStartScripts rather than its superclass org.gradle.jvm.application.tasks.CreateStartScripts [#​39764](spring-projects/spring-boot#39764) - When using Logback, log messages appear in a single line when application name contains brackets [#​39564](spring-projects/spring-boot#39564) #### 📔 Documentation - Document support for Java 22 [#​40046](spring-projects/spring-boot#40046) - Fix web session javadoc typo [#​39821](spring-projects/spring-boot#39821) - Fix typo in Custom HTTP Exchange Recording section [#​39784](spring-projects/spring-boot#39784) - Make description of virtual threads and JVM exit easier to understand by removing "no-non" double-negative [#​39732](spring-projects/spring-boot#39732) #### 🔨 Dependency Upgrades - Upgrade to Angus Mail 2.0.3 [#​39973](spring-projects/spring-boot#39973) - Upgrade to Glassfish JAXB 4.0.5 [#​39975](spring-projects/spring-boot#39975) - Upgrade to Graph...
I recently upgraded to Spring Boot 3.2.2. After the update, all log messages appeared in one single line:
The 3.2 Release Notes state, that the application name is now included in the log messages. I had my application name setup with a
... (dev)
at the end which was the cause for this issue.Observed Behavior
On a new spring boot 3.2.2 project (I used Kotlin for both, the source code and Gradle config):
)
(e.g.spring.application.name=Test Name (dev)
), all logs appear in a single line (see example above)(
but no)
everything is fine(
and)
, the behavior is the same as with only the closing bracket[
and/or]
caused an issue}
but no opening{
, e.g.spring.application.name=Test Name }dev
everything after the}
is cut away:{
and}
, e.g.spring.application.name=Test Name {dev}
everything looks fine:{
but no}
, e.g.spring.application.name=Test Name {dev
the application fails to start:Expected behavior
Regardless of the appearance of any of
([{}])
in the application name, the log output is formatted correctlyThe text was updated successfully, but these errors were encountered: