Hi Team,
We are using Maven Build Plugins for creataing and deploying proxies in bulk. We are deploying the proxies using maven command. While deploying, we are not adding relative path in SLM logging policy, so we can test it and update the realtive path in SLM logging after testing.
Could you please let us know, How we can update the SLM logging relative path for all proxies after the deployment, Is there any plugin or maven command present to just update the single policy of deployed proxies.
Regards,
Rohit Karadi
Can you provide an example ? What are you trying to change ?
Hi Sai,
Below is the code snippet from Api_SLM_Logger policy.
While deploying the proxy we are keeping SLM policy like below (Without relative path)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageLogging async="false" continueOnError="true" enabled="true" name="Api_SLM_Logger">
<DisplayName>Api_SLM_Logger</DisplayName>
<FaultRules/>
<Properties/>
<BufferMessage>false</BufferMessage>
<File async="true"> <FileName>api_SLM_mpgOPSSoapV1_AuthenticationService_new.log</FileName>
After the deployment, we want to update the SLM policy with relative path so logs can be generated to one specific folder only
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageLogging async="false" continueOnError="true" enabled="true" name="Api_SLM_Logger">
<DisplayName>Api_SLM_Logger</DisplayName>
<FaultRules/>
<Properties/>
<BufferMessage>false</BufferMessage>
<File async="true"><FileName>../../../../../../logs/api/wsm/api_SLM_mpgOPSSoapV1_AuthenticationService_new.log</FileName>
Here we are using maven plugin to create the bundle in bulk , and we want to update the this single policy after the deployment and testing for each deployed proxy.
Regards,
Rohit Karadi
Answer by Sai Saran Vaidyanathan
·
May 12, 2020 at 06:12 PM
Yes you can do this using the config.json file which will have the configuration for updating policy while building the package and deploying. Check out this sample. You will find the config.json that has some configuration. Depending on the Maven profile you call, it pulls the appropriate values and updates the file.
Let's say you have two pom profile - "test" and "prod", then your config.json will look like this
{ "configurations": [ { "name": "test", "policies": [ { "name": "Api_SLM_Logger.xml", "tokens": [ { "xpath": "/MessageLogging/File/FileName", "value": "../../../../../../logs/api/wsm/api_SLM_mpgOPSSoapV1_AuthenticationService_new.log" } ] } ], "proxies": [], "targets": [] }, { "name": "prod", "policies": [ { "name": "Api_SLM_Logger.xml", "tokens": [ { "xpath": "/MessageLogging/File/FileName", "value": "../../../../../../logs/api/wsm/api_SLM_mpgOPSSoapV1_AuthenticationService_prod.log" } ] } ], "proxies": [], "targets": [] } ] }
So when you call "mvn install -Ptest", then the deploy plugin will pick this config.json and apply it. So in the target directory, you will see that the policy value will be updated to what you have in this config.json.
With this you can then externalize the values in the config.json and have the plugin pick and apply while packaging. Hope this helps !
@Rohit Karadi - did you try this ? Did it work ?