Questions tagged [spring-logback]

288 questions
14
votes
4 answers

Is there a recommended way to get spring boot to JSON format logs with logback

Using spring boot 2.1.1.RELEASE one can seemingly format logs as JSON by providing a logback-spring.xml file as follows:
David
  • 7,652
  • 21
  • 60
  • 98
12
votes
2 answers

SpringBoot with LogBack creating LOG_FILE_IS_UNDEFINED folder

I am using SpringBoot with LogBack and I am trying to direct all log-statements of one specific package (here shown as "com.example.somepackagename") to a file. All other log statements should go to stdout. At first ran into the issue that during…
mmo
  • 3,897
  • 11
  • 42
  • 63
11
votes
1 answer

ERROR Unable to process event: 'java.time.Instant ch.qos.logback.classic.spi.ILoggingEvent.getInstant()'

I tried to use logstash-logback-encoder with spring boot for sending logs to the ELK. but unfortunately I get this error. |-ERROR in net.logstash.logback.appender.LogstashTcpSocketAppender[LOGSTASH] - Unable to process event: 'java.time.Instant…
11
votes
1 answer

SLF4J with Logback: NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

I'm trying to implement a RollingFile Logger using SLF4J and Logback in particular, but I'm stuck with an exception, that I can't resolve. Here it is: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder …
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
7
votes
1 answer

how to include xml in log-back.xml

I am writing a custom spring boot starter project for logging. My logback-spring.xml become large and want to put the appenders in separate file (console-appender.xml and file-appender.xml) and want to include in the logback-spring.xml file like…
sagar kancherla
  • 129
  • 1
  • 3
  • 12
7
votes
0 answers

Replacement for Logback LevelRemappingAppender in Spring Boot 2?

I'm migrating an application from Spring Boot 1.x to 2.x and I found some entries in the logback configuration which use a LevelRemappingAppender, like this:
Fletch
  • 4,829
  • 2
  • 41
  • 55
6
votes
1 answer

How do I wrap some of the methods of logstash logback encoder into an inner field?

I want to be able to have some of the fields that get generated by logstash logback encoder to be wrapped within another field. Can this be done by the XML configuration inside of logback-spring.xml or do I have to implement some class and then…
Kirit
  • 389
  • 2
  • 3
  • 11
5
votes
1 answer

Is logging a non-blocking operation in Spring Webflux?

Do I need to worry about logging to console, using Slf4j on top of Logback, being a blocking operation? I wasn't sure, so I've been using reactor.logback.AsyncAppender from io.projectreactor.addons:reactor-logback:3.2.3-RELEASE The issue I have now…
5
votes
3 answers

Spring boot logging how to set logging.file.max-size unlimited

I am working with spring boot application where I am using logback for LOGGING purpose and I want to store my log on log file with unlimited size but default size of logging.file.max-size property is 10MB can anyone help me that what value I need to…
Piyush Chaudhari
  • 962
  • 3
  • 19
  • 41
4
votes
0 answers

How to mask sensitive data usi CustomObjectMapper in logback-spring.xml

I have written @Mask annotation to mask sensitive information in logs. It is working fine when I log data using custom JacksonAnnotationIntrospector with ObjectMapper. I want to use this at logback-spring.xml so that any field annotated with @Mask…
4
votes
0 answers

Using include to reuse encoder configuration in Logback

Is there a way to reuse/parameterize an encoder configuration in logback xml configuration file? I have read that "Each layout/encoder is associated with one and only one appender, referred to as the owning appender." But instead of using one…
DylanS
  • 41
  • 4
4
votes
0 answers

Load Logback config from the library in Spring Boot application

I'm trying to build a logging library which will be used across my services. I would like it to come with a default Logback configuration (predefined appenders). Is there a way to tell the application to load that config when the library is added to…
Pawel
  • 466
  • 1
  • 7
  • 20
4
votes
3 answers

logback spring turn off console logging based on spring profile

Here is my sample logback-spring.xml
opuser1
  • 427
  • 7
  • 29
4
votes
2 answers

How to use Spring applications properies in logback.xml

I'm trying to use spring property values in logback.xml. The file application-dev.properties (which is part of my jar) contains the property: myapp.test.appender-class=ch.qos.logback.core.ConsoleAppender and I added the following in the…
gillyn
  • 51
  • 1
  • 3
1
2 3
19 20