I have a java swing project that will end up in a fat client. There is no JEE background, no application server or servlet container will be involved. Nor any other runtime container then a plain JVM.
I am using the build tool maven to manage dependencies and to build the application.
I am using logback api for logging purposes.
Now I have two build profiles, one for building a developer version and one for building the final version.
Is it possible to set values to the logback.xml file using a maven property? For example, I have the following <root level="${log.level}">
tag in my logback.xml. Now I want to define the value of ${log.level}
in my maven build profile. Is it possible?
This question is not related to
It is certainly possible, with maven resource filtering. https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
I would strongly recommend not to do it this way though. Managing 2 binaries just for the sake of having different properties seems an overkill.
I would recommend some setting on the target host (env variable, parameter to your program) that will allow you to select log level at runtime.
Passing log level, name or path of logging config, or name of target environment (dev/prod) are all acceptable solutions.