[JAVA] I want to pass APP_HOME to logback in Gradle

When you want to change the output destination of the log according to the directory where the application is expanded, etc.

https://www.mkyong.com/gradle/gradle-application-plugin-app_home-in-applicationdefaultjvmargs/

The above manma. But isn't it too small?

build.gradle



applicationDefaultJvmArgs = [ "-DappHome=MY_APP_HOME" ]

startScripts {
doLast {
           unixScript.text = unixScript.text.replace('MY_APP_HOME', '\$APP_HOME')
    }
}

logback.xml


  <appender name="APPLOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${appHome}/logs/app.log</file>
     ~(The following is omitted)

Recommended Posts

I want to pass APP_HOME to logback in Gradle
I want to use @Autowired in Servlet
I want to send an email in Java.
I want to use arrow notation in Ruby
rsync4j --I want to touch rsync in Java.
[Xcode] I want to manage images in folders
I want to be eventually even in kotlin
I want to get the value in Ruby
I want to use Combine in UIKit as well.
I want to use Clojure's convenient functions in Kotlin
I want to do something like "cls" in Java
I want to embed any TraceId in the log
I want to use fish shell in Laradock too! !!
I want to use ES2015 in Java too! → (´ ・ ω ・ `)
I want to use a little icon in Rails
I want to define a function in Rails Console
I want to stop snake case in table definition
I want to click a GoogleMap pin in RSpec
I want to find a relative path in a situation using Path
I want to set the conditions to be displayed in collection_check_boxes
I want to perform high-speed prime factorization in Ruby (ABC177E)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I want to create a Parquet file even in Ruby
I want to transition to the same screen in the saved state
I want to pass the startup command to postgres with docker-compose.
I want to simplify the conditional if-else statement in Java
Swift: I want to chain arrays
How to run Ant in Gradle
I want to use FormObject well
I want to convert InputStream to String
I want to docker-compose up Next.js!
[Ruby] I want to put an array in a variable. I want to convert to an array
I want to get some properties as JSON strings in Jackson!
I want to display the images under assets/images in the production environment
I want to add devise in Rails, but I can't bundle install
I want to remove the top margin in Grouped UITableView (swift)
[Java] I want to perform distinct with the key in the object
I want to change the value of Attribute in Selenium of Ruby
[Android] I want to get the listener from the button in ListView
[Ruby] I want to output only the odd-numbered characters in the character string
I want to develop a web application!
[Rails] I want to send data of different models in a form
I want to write JSP in Emacs more easily than the default.
I want to write a nice build.gradle
I want to eliminate duplicate error messages
How to filter JUnit Test in Gradle
I want to make an ios.android app
I want to display background-ground-image on heroku.
I want to use DBViewer with Eclipse 2018-12! !!
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (PowerMockito edition)
I want to RSpec even at Jest!
I want to write a unit test!
(Limited to Java 7 or later) I want you to compare objects in Objects.equals
I want to install PHP 7.2 on Ubuntu 20.04.
[Note] I want to get in reverse order using afterLast with JdbcTemplate
I want to pass the argument of Annotation and the argument of the calling method to aspect
[Ruby] I want to display posted items in order of newest date
I want to display a PDF in Chinese (Korean) with thin reports
My memorandum that I want to make ValidationMessages.properties UTF8 in Spring Boot
I want to stop Java updates altogether
I want to get the IP address when connecting to Wi-Fi in Java