bookmark_borderCommon Application properties in Spring

1. Core Properties

KeyDefault ValueDescription
debugfalseEnable debug logs.
info.*Arbitrary properties to add to the info endpoint.
logging.charset.consoleCharset to use for console output.
logging.charset.fileCharset to use for file output.
logging.configLocation of the logging configuration file. For instance, `classpath:logback.xml` for Logback.
logging.exception-conversion-word%wExConversion word used when logging exceptions.
logging.file.nameLog file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory.
logging.file.pathLocation of the log file. For instance, `/var/log`.
logging.group.*Log groups to quickly change multiple loggers at the same time. For instance, `logging.group.db=org.hibernate,org.springframework.jdbc`.
logging.level.*Log levels severity mapping. For instance, `logging.level.org.springframework=DEBUG`.
logging.logback.rollingpolicy.clean-history-on-startfalseWhether to clean the archive log files on startup.
logging.logback.rollingpolicy.file-name-pattern${LOG_FILE}.%d{yyyy-MM-dd}.%i.gzPattern for rolled-over log file names.
logging.logback.rollingpolicy.max-file-size10MBMaximum log file size.
logging.logback.rollingpolicy.max-history7.0Maximum number of days archive log files are kept.
logging.logback.rollingpolicy.total-size-cap0BTotal size of log backups to be kept.
logging.pattern.console%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}Appender pattern for output to the console. Supported only with the default Logback setup.
logging.pattern.dateformatyyyy-MM-dd HH:mm:ss.SSSAppender pattern for log date format. Supported only with the default Logback setup.
logging.pattern.file%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}Appender pattern for output to a file. Supported only with the default Logback setup.
logging.pattern.level%5pAppender pattern for log level. Supported only with the default Logback setup.
logging.register-shutdown-hookfalseRegister a shutdown hook for the logging system when it is initialized.
spring.aop.autotrueAdd @EnableAspectJAutoProxy.
spring.aop.proxy-target-classtrueWhether subclass-based (CGLIB) proxies are to be created (true), as opposed to standard Java interface-based proxies (false).
spring.application.admin.enabledfalseWhether to enable admin features for the application.
spring.application.admin.jmx-nameorg.springframework.boot:type=Admin,name=SpringApplicationJMX name of the application admin MBean.
spring.application.nameApplication name.
spring.autoconfigure.excludeAuto-configuration classes to exclude.
spring.banner.charsetUTF-8Banner file encoding.
spring.banner.image.bitdepth4.0Bit depth to use for ANSI colors. Supported values are 4 (16 color) or 8 (256 color).
spring.banner.image.heightHeight of the banner image in chars (default based on image height).
spring.banner.image.invertfalseWhether images should be inverted for dark terminal themes.
spring.banner.image.locationclasspath:banner.gifBanner image file location (jpg or png can also be used).
spring.banner.image.margin2.0Left hand image margin in chars.
spring.banner.image.pixelmodeTEXTPixel mode to use when rendering the image.
spring.banner.image.width76.0Width of the banner image in chars.
spring.banner.locationclasspath:banner.txtBanner text resource location.
spring.beaninfo.ignoretrueWhether to skip search of BeanInfo classes.
spring.codec.log-request-detailsfalseWhether to log form data at DEBUG level, and headers at TRACE level.
spring.codec.max-in-memory-sizeLimit on the number of bytes that can be buffered whenever the input stream needs to be aggregated. This applies only to the auto-configured WebFlux server and WebClient instances. By default this is not set, in which case individual codec defaults apply. Most codecs are limited to 256K by default.
spring.config.activate.on-cloud-platformRequired cloud platform for the document to be included.
spring.config.activate.on-profileProfile expressions that should match for the document to be included.
spring.config.additional-locationConfig file locations used in addition to the defaults.
spring.config.importImport additional config data.
spring.config.locationConfig file locations that replace the defaults.
spring.config.nameapplicationConfig file name.
spring.info.build.encodingUTF-8File encoding.
spring.info.build.locationclasspath:META-INF/build-info.propertiesLocation of the generated build-info.properties file.
spring.info.git.encodingUTF-8File encoding.
spring.info.git.locationclasspath:git.propertiesLocation of the generated git.properties file.
spring.jmx.default-domainJMX domain name.
spring.jmx.enabledfalseExpose management beans to the JMX domain.
spring.jmx.servermbeanServerMBeanServer bean name.
spring.jmx.unique-namesfalseWhether unique runtime object names should be ensured.
spring.lifecycle.timeout-per-shutdown-phase30sTimeout for the shutdown of any phase (group of SmartLifecycle beans with the same ‘phase’ value).
spring.main.allow-bean-definition-overridingfalseWhether bean definition overriding, by registering a definition with the same name as an existing definition, is allowed.
spring.main.banner-modeconsoleMode used to display the banner when the application runs.
spring.main.cloud-platformOverride the Cloud Platform auto-detection.
spring.main.lazy-initializationfalseWhether initialization should be performed lazily.
spring.main.log-startup-infotrueWhether to log information about the application when it starts.
spring.main.register-shutdown-hooktrueWhether the application should have a shutdown hook registered.
spring.main.sourcesSources (class names, package names, or XML resource locations) to include in the ApplicationContext.
spring.main.web-application-typeFlag to explicitly request a specific type of web application. If not set, auto-detected based on the classpath.
spring.mandatory-file-encodingExpected character encoding the application must use.
spring.messages.always-use-message-formatfalseWhether to always apply the MessageFormat rules, parsing even messages without arguments.
spring.messages.basenamemessagesComma-separated list of basenames (essentially a fully-qualified classpath location), each following the ResourceBundle convention with relaxed support for slash based locations. If it doesn’t contain a package qualifier (such as “org.mypackage”), it will be resolved from the classpath root.
spring.messages.cache-durationLoaded resource bundle files cache duration. When not set, bundles are cached forever. If a duration suffix is not specified, seconds will be used.
spring.messages.encodingUTF-8Message bundles encoding.
spring.messages.fallback-to-system-localetrueWhether to fall back to the system Locale if no files for a specific Locale have been found. if this is turned off, the only fallback will be the default file (e.g. “messages.properties” for basename “messages”).
spring.messages.use-code-as-default-messagefalseWhether to use the message code as the default message instead of throwing a “NoSuchMessageException”. Recommended during development only.
spring.output.ansi.enableddetectConfigures the ANSI output.
spring.pid.fail-on-write-errorFails if ApplicationPidFileWriter is used but it cannot write the PID file.
spring.pid.fileLocation of the PID file to write (if ApplicationPidFileWriter is used).
spring.profiles.activeComma-separated list of active profiles. Can be overridden by a command line switch.
spring.profiles.includeUnconditionally activate the specified comma-separated list of profiles (or list of profiles if using YAML).
spring.quartz.auto-startuptrueWhether to automatically start the scheduler after initialization.
spring.quartz.jdbc.comment-prefix[#, --]Prefixes for single-line comments in SQL initialization scripts.
spring.quartz.jdbc.initialize-schemaembeddedDatabase schema initialization mode.
spring.quartz.jdbc.schemaclasspath:org/quartz/impl/jdbcjobstore/tables_@@platform@@.sqlPath to the SQL file to use to initialize the database schema.
spring.quartz.job-store-typememoryQuartz job store type.
spring.quartz.overwrite-existing-jobsfalseWhether configured jobs should overwrite existing job definitions.
spring.quartz.properties.*Additional Quartz Scheduler properties.
spring.quartz.scheduler-namequartzSchedulerName of the scheduler.
spring.quartz.startup-delay0sDelay after which the scheduler is started once initialization completes. Setting this property makes sense if no jobs should be run before the entire application has started up.
spring.quartz.wait-for-jobs-to-complete-on-shutdownfalseWhether to wait for running jobs to complete on shutdown.
spring.reactor.debug-agent.enabledtrueWhether the Reactor Debug Agent should be enabled when reactor-tools is present.
spring.task.execution.pool.allow-core-thread-timeouttrueWhether core threads are allowed to time out. This enables dynamic growing and shrinking of the pool.
spring.task.execution.pool.core-size8.0Core number of threads.
spring.task.execution.pool.keep-alive60sTime limit for which threads may remain idle before being terminated.
spring.task.execution.pool.max-sizeMaximum allowed number of threads. If tasks are filling up the queue, the pool can expand up to that size to accommodate the load. Ignored if the queue is unbounded.
spring.task.execution.pool.queue-capacityQueue capacity. An unbounded capacity does not increase the pool and therefore ignores the “max-size” property.
spring.task.execution.shutdown.await-terminationfalseWhether the executor should wait for scheduled tasks to complete on shutdown.
spring.task.execution.shutdown.await-termination-periodMaximum time the executor should wait for remaining tasks to complete.
spring.task.execution.thread-name-prefixtask-Prefix to use for the names of newly created threads.
spring.task.scheduling.pool.size1.0Maximum allowed number of threads.
spring.task.scheduling.shutdown.await-terminationfalseWhether the executor should wait for scheduled tasks to complete on shutdown.
spring.task.scheduling.shutdown.await-termination-periodMaximum time the executor should wait for remaining tasks to complete.
spring.task.scheduling.thread-name-prefixscheduling-Prefix to use for the names of newly created threads.
tracefalseEnable trace logs.

application.properties or application.yml

Save HTTP Request Access Log as file.

server.tomcat.accesslog.pattern=common
server.tomcat.accesslog.enabled=true   
server.tomcat.basedir=.
server:
  tomcat:
    basedir: .
    accesslog:
      pattern: common
      enabled: true
  • Directory logs will be automatically created.
    • access_log.2020-xx-xx.log
0:0:0:0:0:0:0:1 - - [24/Nov/2020:21:52:12 +0900] "GET /greeting HTTP/1.1" 200 45
0:0:0:0:0:0:0:1 - - [24/Nov/2020:21:52:20 +0900] "GET /greeting HTTP/1.1" 200 45

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#spring.jta.enabled

ANOTE.DEV