wttech / gradle-aem-plugin

Swiss army knife for Adobe Experience Manager related automation. Environment setup & incremental AEM application build which takes seconds, not minutes.
https://tech.cognifide.com/tag/gradle-aem-plugin
Apache License 2.0
157 stars 32 forks source link

Remote log tailing #138

Closed pun-ky closed 5 years ago

pun-ky commented 6 years ago

Imagine

sh gradlew aemTail -Paem.instance.name=int-publish -Paem.tail.name=logs/error.log

or using shorthand syntax:

sh gradlew aemTail -Paem.tail=int-publish:logs/error.log

or even if default specified as:

aem {
    config {
        tail = propParser.string("aem.tail", "int-author:logs/error.log")
        tailMaxErrors = 20
        tailMaxWarnings = 30
        /*
        tailStatus = { status-> 
            if (status.logs.filter { it.contains("error") }.isNotEmpty()  {
                status.text = "UNSTABLE"
            } else 
                status.text = "STABLE" {
            }
           def grep = propParser.string("aem.tail.grep")
           if (grep != null) {
                status.grep(grep)
           }
         }
    }
}

then just

sh gradlew aemTail

will grab logs using url http://x.x.x.x:4503/system/console/slinglog/tailer.txt?_dc=1520834477194&tail=400&name=%2Flogs%2Ferror.log

and output it interactively as aemAwait does.

it would be nice that status bar will compute some summary like below:

<-------------> 0% EXECUTING [9m 33s]
> :aem:aemTail > local-author [errors: 40, warnings: 120] - UNSTABLE
12.03.2018 06:57:02.117 *INFO* [qtp687303746-206125] org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials
12.03.2018 06:57:04.119 *INFO* [qtp687303746-206125] org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials

UNSTABLE/STABLE displayed will depend on configured maximum error/warnings per minute rate.

pun-ky commented 6 years ago

I can consider implementing it if there will be some positive votes on comment above

piotr-wilczynski commented 6 years ago

Could be useful with filtering capability

pun-ky commented 6 years ago

yep, in callback, I've just updated comment for DSL proposal

pun-ky commented 6 years ago

This feature will have another form as illustrated because multi-line logging in progress logger is not possible directly. Instead aemTail will continously grab and append log lines from all instances into local files e. G build/aem/aemTail/local- author/logs/error.log. User will be able to view that file in any tool that he like e.g Unix tail program or even some advanced tool like intellij grep console plugin or other tool which could highlight log lines or parse it. In progress logger there will be printed summary similar to which aemAwait is showing but it will count errors and warnings per instance / that will be configurable / what will be displayed there

pun-ky commented 6 years ago

final design / default behavior:

sh gradlew aemTail -Paem.tail=[int-author:logs/error.log,int-publish:logs/error.log]

mierzwid commented 5 years ago

Additional comments:

Next steps:

pun-ky commented 5 years ago

released as 6.1.0-beta :)