Is possible to load log4j2 config.yml from config server or reaload spring boot logging configuration allways from the config server?
Or get the config from a git?
For example:
logging:
config: http://xxx.xx.xx.xx:3000/admin123/config-repository/src/master/log4j2.yml
You must read the file in raw mode to get the configuration from gogs.
So, your url with be something like this:
http://xxx.xx.xx.75:3000/admin123/config-repository/raw/master/log4j2.xml
Yes, by specifying the destination URL with system property log4j.configurationFile. This accepts any wellformed URL.
Related
I have specified some webservice endpoints into applicaiton.properties file as below
application.properties
config.middleware.soap.service.endpoint.sample=http://xxx.xxx/sample/
Now i want to directly use those values into another configuration file that is in my case root-context.xml file for creating soap class using jax-ws client. but the property is never understood by spring boot if i refer it from applicaiton.properties value. why not? if i directly provide the endpoint it works. what is the simplest way to use application.properties file values into anther configuration file?
root-context.xml
<jaxws:client id="sampleClient" serviceClass="com.sample.wsdl.sample"
address="${config.middleware.soap.service.endpoint.sample}">
...
</jaxws:client>
in my case both the root-context and application.properties file reside in src/main/resources folder.. so i assume both the files gets loaded on classpath when the applcation boot strap.
It worked finally when i used it in below mentioned way
<jaxws:client id="acctInqClient" serviceClass="com.ge.india.capital.wsdl.spine.AcctInq"
address="#{environment['config.middleware.soap.service.endpoint.sample']}">
provided, i declared one property in the name config.middleware.soap.service.endpoint.sample in the applicaiton.properties file.
But i would like to know why only ${config.middleware.soap.service.endpoint.sample} didn't work. thank you.
I am configuring logback programmatically. I am also using Spring Boot, and I would like to set the logs location in application.properties. I know in XML there is a springProperty tag, where is this in the Java API?
in spring-boot you can define logging config in application.properties
logging.path = /path/to/folder/log
logfile would then be named spring.log
[Using logging.path] Writes spring.log to the specified directory.
Names can ?be an exact location or relative to the current directory.
Here: is nice article about logging with springboot
I just setup a Spring Cloud Config server and have an application.yml file that should contain:
hostname: ${MY_ENV_VARIABLE}
When I pull that config file, the placeholder gets expanded before being sent instead of being sent to the application so that the application can expand it.
How do I either make Spring Cloud Config server stop expanding environment placeholders in the configuration files being served or escape the placeholders?
This question is due to ignorance on my part. When you request the configuration as Spring Boot does, e.g., https://config-server:8888/myapp/myprofile/master, then you get the JSON that describes the configuration and NO PROPERTY EXPANSION OCCURS. But, when you test the configuration by requesting it as a YAML file, e.g., https://config-server:888/myapp-myprofile.yaml, then property expansion occurs before the YAML file is displayed.
So, for my purposes, this works fine. I just need to be aware of it when checking that configurations are valid.
In Spring Cloud Zuul server we can define all routes which need be redirected via "application.properties".
For example:
zuul.routes.resource.path=/api/**
zuul.routes.resource.url=http://api.com:9025
Once the fat jar is created the "application.properties" is encapsulated into jar, and it's not possible to edit and reload the rules inside the file.
Is there any to inform Zuul about the routes in an external file, and at the same time reload them without stopping the server?
You can use spring cloud config for that.
Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have a central place to manage external properties for applications across all environments
http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_client
...a bit late to the party, but...
You can do all that you want with the ConfigServer!
Create an application.yml for config that is common across ALL applications
Create profile specific application-mycommonprofile.yml. As 1. but for the 'mycommonprofile' profile.
Create an appX.yml for each application that is specific to that application.
Create profile specific appX-myprofile.yml. As 3. but for the 'myprofile' profile.
All of these files are optional and are not dependent on any others. You can have an application-mycommonprofile.yml without an application.yml for example.
Hope that helps!
Another late-to-the-party answer, but another way is to use a profile config file, which lives in the filesystem, outside the fatjar.
If the configuration name of your Zuul proxy is 'zuul' and your normal config file is 'zuul.properties' or 'zuul.yaml', then it looks for a profile-specific config file in 'zuul-.properties' or 'zuul-.yaml'.
If you do not specify a profile, then the profile named 'default' is active.
So you can load properties from an external file name 'zuul-default.properties' or 'zuul-default.yaml' (or 'zuul-default.yml', if you use a 3-letter filename extension).
This will then be loaded when no other profile is specified.
I am new to dropwizard.
I want to know is their any other way to set the connection port, admin port, logger level and all configuration parameters and not by use .YML file.
You can use command like param when starting the application.
Its all within the docs within the Configuration section.
For example:
-Ddw.server.applicationConnectors[0].port=9090