cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Run a groovy script using ant command

john_caswell
Explorer
0 Likes
1,043

error2.png error1.png

Hello,

We are trying to run the below groovy script using ant command.

groovy script :

import org.apache.log4j.LogManager

import org.apache.log4j.Logger

import org.apache.log4j.Level

def classnamearray = ["de.hybris.platform.jalo.flexiblesearch.FlexibleSearch","de.hybris.platform.cronjob.jalo.FlexibleSearchCronJob"]

String setlevel = "INFO"

for (logclassname in classnamearray){

mapLoggers = ["${logclassname}" : "${setlevel}"]

mapLoggers.collect {

Logger logger = LogManager.getLogger(it.getKey())

println "Before: " + logger.getName() + "=" + logger.getLevel()

logger.setLevel(Level.toLevel(it.getValue())) println "After : " + logger.getName() + "=" + logger.getLevel()

} }

This is working correctly when we run in HAC. The Hybris version we are using is 5.7.0. When we are trying to run this script using ant we are getting below error:

[java] WARN [main] [ProtocolConfiguration] variable "${hybris.datasource.jndi.name}" in JDBC_PING could not be substituted; datasource_jndi_name is removed from properties [java]

ERROR [AfterSaveEventPublisher-master] [CronJobManager] cannot start task engine since task service does not provide engine handle [java] WARN [main] [Configurator] JGRP000014: TP.discard_incompatible_packets has been deprecated: incompatible packets are discarded anyway [java]

WARN [main] [Configurator] JGRP000014: TP.enable_bundling has been deprecated: will be ignored as bundling is on by default

We are getting single instance of this error and also build successful in the logs but we are unable to see the changes in loglevel of the classes in HAC which we are expecting after the script run.

We have placed this script in platform folder and tried below command :

. ./setantenv.sh && ant executeScript -Dresource=loglevel.groovy

Also we tried to place this in home folder and exceuted below command : .

. ./setantenv.sh && ant executeScript -Dresource=/home/appuser/loglevel.groovy (appuser is assigned user for hybris)

Can someone please help us with how to execute this script using ant command.

Accepted Solutions (0)

Answers (0)