Questions tagged [logback-classic]
119 questions
17
votes
2 answers
Spring @PreDestroy: No logging because Logback stops too soon
In my project, I am using Logback as logging facility. I have the following class
@Component
class Test {
@PreDestroy
public void destroy() {
try {
...
} catch (Exception e) {
…

Harrold_dev
- 183
- 6
12
votes
3 answers
JSON Layout with Pattern in Logback Java
I am using logback for logging in my spring boot application and using the pattern as per:
"%d [%thread] %-5p [%c] [%F:%L] [trace=%X{X-B3-TraceId:-},span=%X{X-B3-SpanId:-}] - %msg%n"
Now I want to move to the JSON layout for my logs. But I don't…

Harshit Gupta
- 167
- 1
- 1
- 10
9
votes
1 answer
Spring Boot logback.xml creating .tmp Files
I am trying to persist the logs of a Spring Boot Application, however, since the logs generated are large I am trying to use the logback.xml to roll the file greater than 350MB into a compressed file.
I am able to roll a couple of MB's per day but…

Akshay
- 457
- 5
- 14
8
votes
1 answer
Logback and JsonLayout: can't pass custom fields
I have this configuration in my logback.xml into a Spring Web Application (NO Spring Boot).

HK15
- 737
- 1
- 14
- 32
8
votes
1 answer
Logback: SizeAndTimeBasedRollingPolicy applies totalSizeCap to each day in maxHistory
Logback version 1.2.3
I want to use a SizeAndTimeBasedRollingPolicy in our logback configuration file (logback.xml), but at this time the SizeAndTimeBasedRollingPolicy doesn't function as expected.…

Iggydv
- 166
- 2
- 12
6
votes
2 answers
Dynamic log level changes with Logback in a docker app
Logback has a feature to scan changes in logback.xml (per this) - this is a great feature which allows long running applications to be shipped with INFO as default level to be changed to DEBUG when something has to be briefly investigated.
But in my…

Bharadwaj
- 1,361
- 1
- 9
- 24
5
votes
2 answers
How can I log the logback actions into a file?
I'd like to log the "ch.qos.logback" classes into a log file using Logback, but it is logging just in the Console and not in the file.
Is it possible?
I need it for an investigation of some problems with logback.
This is my logback configuration…

Jardel Novaes
- 188
- 7
5
votes
1 answer
Definitive answer on slf4j and logback-classic transitive dependency
I have really struggled with the loading of logback-classic as a transitive dependency problem. I follow the advice found here on stackoverflow, but, it keeps re-occurring.
I use maven exclusions to try to try to control it, it does not appear at…

oldDave
- 395
- 6
- 25
4
votes
2 answers
Logback-classic 1.2.8 DBAppender Missing
I'm trying to upgrade the logback-classic library from version 1.2.3 to 1.2.8. The patch notes say that all DB related code has been removed, so the main DBAppender class no longer exists in the new version https://logback.qos.ch/news.html. Has…

Arush Shah
- 41
- 2
4
votes
1 answer
ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
I am converting a spring app to spring-boot, using boot-starter-parent version: 2.0.4.RELEASE. When I build using
mvn install, its is going through fine, but when I am trying to run the app using command:mvn spring-boot:run…

Nitin1706
- 621
- 1
- 11
- 21
4
votes
1 answer
How to display the identity hash code of an instance in logback's encoder pattern?
The encoder pattern in logback.xml like
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
allows to…

Kalle Richter
- 8,008
- 26
- 77
- 177
3
votes
0 answers
How to define Map in logback.xml?
I would like to inject some static labels into my custom logback layout.
What is the proper syntax to define a Map in logback.xml?
Basic logback.xml:

Andrii Abramov
- 10,019
- 9
- 74
- 96
3
votes
1 answer
logback(1.3.0) & slf4j(2.0.0-alpha2) version combination does not work
So we get below NoClassDefFoundError if we upgrade slf4j => 1.8.0 or higher.
logback-classic-1.3.0-alpha4.jar
logback-core-1.3.0-alpha4.jar
slf4j-api-1.8.0-alpha2.jar
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder displayed in…

prasanth jalasutram
- 31
- 2
3
votes
2 answers
Logback upgrade from 1.1.11 to 1.3.0-alpha4 in Spring boot-1.5.8 application
Spring boot 1.5.8 by default providing logback-1.1.11 version.
I am trying to upgrade the logback version from 1.1.11 to 1.3.0-alpha4 and added the below two properties in…

Sivakumar Nalle
- 33
- 1
- 3