Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
Cómo configurar las propiedades de logback.xml en application.yaml

Tengo logback.xml así:

 <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="2 seconds"> <include resource="org/springframework/boot/logging/logback/base.xml"/> <jmxConfigurator/> <logger name="org.springframework" level="INFO"/> <logger name="org.springframework.web.filter.CommonsRequestLoggingFilter" level="DEBUG"/> <logger name="com.mypackage" level="WARN"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> <turboFilter class="ch.qos.logback.classic.turbo.DynamicThresholdFilter"> <Key>dynamicLogLevel</Key> <DefaultThreshold>DEBUG</DefaultThreshold> <MDCValueLevelPair> <value>dynamicLogLevelDEBUG</value> <level>DEBUG</level> </MDCValueLevelPair> <!-- dynamicLogLevelERROR for testing --> <MDCValueLevelPair> <value>dynamicLogLevelERROR</value> <level>ERROR</level> </MDCValueLevelPair> </turboFilter> ..... </configuration>

Quiero configurar el nivel de registro, los appenders, la política continua presente en logback.xml en application.yaml .

Revisé este Doc pero no encontré suficiente información.

Estoy usando spring-boot 1.4.4-RELEASE .

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

La etiqueta springProperty es probablemente todo lo que necesita. Spring Boot filtrará automáticamente las propiedades de source en su archivo de configuración y reemplazará los marcadores de posición con los valores correspondientes de sus propiedades.

 <configuration scan="true" scanPeriod="2 seconds"> <springProperty name="yourVar" source="key.of.your.yaml.property"/> ...${yourVar}...

Puedes ver los detalles en el repositorio de GitHub .

about 4 years ago · Santiago Trujillo Report

0

Encontré la solución: Mi application.yaml en alguna carpeta (digamos C:/configuration/application.yaml , c:/configuration/logback.xml ).

En logback.xml , podemos acceder al contenido de application.yaml usando:

 <property file="${HOME}/configuration/application.yaml"/>

por ejemplo: en application.yaml

 LOG_FILE : C:/logs

en logback.xml acceda a él:

 <appender name="MY_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_FILE}</file> ... </appender>

Pero tenga cuidado con el valor scanPeriod en

 <configuration scan="true" scanPeriod="10 seconds">

Espero que ayude

about 4 years ago · Santiago Trujillo Report

0

logging: level: org.springframework.web: ERROR com.pack.test: INFO pattern: file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" file: <logPath>/test.log
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!