Details
Description
Since ENT-4612 (15.0.0, 14.7.6, 13.4.17, 12.6.26), Groovy output is no longer written to JCR nodes, plus the progress is no longer seen in the UI, except when in "dev mode", i.e. locally, which based on system property project.basedir.
The request is to make this behavior configurable, preferably with a repository setting, or by a different system property, so implementations can decide to keep to the old behavior.
Functional Support
By default, the reason why ENT-4612 was implemented, we won't support writing logs to the repository when not in development mode. However, a customer must be able to override this behavior. Besides that, when support for writing logs to the repository is switched on, by default, a groovy script will still write the logs to log files. However per script, there will be the option to write the logs to the repository by choosing Repository for the Log Target dropdown.
Enable writing logs to the repository
During development mode, writing logs to the repository instead of log files is supported by default. For a deployment, to support this, the system property
groovy.persist.logs.supported = true
must be set.
When this system property is present (or local) development mode, a Groovy Script will have an extra configuration option, the Log Target. By default, the log target will be Log Files but it can be switched to Repository. The selected value is stored with the groovy script.
Since scripts already in history should still have their repository logs accessible if present, showing the logs is not based on the presence of the system property groovy.persist.logs.supported but rather on whether there are repository stored logs available for the script or not
QA Testing
Easiest to test this is starting up the community/testsuite and go to the _http://localhost:8080/cms/systemupdater_ . As the testsuite cargo run profile has:
<container> <systemProperties> <log4j.configurationFile>${project.basedir}/conf/log4j2.xml</log4j.configurationFile> <project.basedir>${project.basedir}</project.basedir> <brc.appconfigpath>${project.basedir}/conf/</brc.appconfigpath> </systemProperties> </container>
and based on project.basedir presence the instance is seen as a 'development mode' instance, when creating or modifying a groovy script, there will be the option dropdown 'Log Target'. By default it is 'Log Files'. When executing the script with 'Log Files' the Log in history will show
Logs are stored in normal log files for logger 'org.onehippo.repository.update.UpdaterExecutionReport' and not visible here
When selecting Repository as Log Target instead, the logs will be visible in the Log for history scripts.
Removing the system property
<project.basedir>${project.basedir}</project.basedir>
and restarting (no new build needed), the option Log Target won't be visible. Older scripts which already had Log Target = Repository will when being executed STILL write the logs to Log Files (on purpose). Older scripts in history which had written logs to the repository will still show the logs in Log when viewing them (for BC reasons to view old scripts)
Adding the system property
<groovy.persist.logs.supported>true</groovy.persist.logs.supported>
will result that the option for Log Target becomes available again
Attachments
Issue Links
- is backported by
-
CMS-15163 Groovy logs in experience manager / console
- Closed
- links to