In order to help monitor what the tinderbox-client are doing
it is desirable to have an activity log for the buildbot plugin, and for the tb3-wrapper plugin.
This feature will be directed by an entry in the plugin's cfg that specify the location of the activity log file.
The presence of that entry trigger the generation of such logs
The log file does not need to exist, but the directory in which it is must exist
Data is appended to the logfiles.
The logfile should not be kept open for longer than necessary, and the logfile is susceptible to 'disappear' at any time (logrotate without sighup)
Logging should be made on a best effort basis.
On starting/loading of the plugin, a special 'start plugin' message is issued. if logging is not possible (file access error, missing directory etc..) a warning is issued in the gerrit error log, but the plugin still try to log after that, but does not warn anymore
On stop of the plugin an activity message is issued using the same format as the load message with s/start/stop/
The content of the logfile is text, one line per event with the folowing format
<iso-8601 datetime in UTC>:<ssh_user invoking>:<plugin_name>:<plugin command line>
'\n' character(s) in <command line>, if present, must be replaced by ' ' to keep the message in one text line.
<username> is assumed to be without ':'. If that assumption is not guaranteed, then ':' in the <username> must be substituted by '_'
2013-10-20T00:39Z:nthiebaud:buildbot:get master -p core --platform LINUX --id tb21
Attention: the datetime _must_ be in UTC, for every messages.
the 'start plugin' message is of the form
<iso-8601 datetime in UTC>::<plugin_name>:>start
the 'stop plugin' message is of the form
<iso-8601 datetime in UTC>::<plugin_name>:>stop
PS: yes <plugin_name> is required because multiple plugins may point to the same activity logfile.
2013-10-20 09:18:14,807:davido:shell:/home/gerrit2/bin/say-hello --user davido --groups 'Administrators' Norbert -a foo bar
activity loggin is using standard Java log4j facility:
Configuration is controlled by:
Custom logging configuration must be activated in Gerrit (only supported from Gerrit 2.8),
in [container] section in $site/gerrit.config -Dlog4j.configuration must be set:
javaOptions = -Dlog4j.configuration=file:///home/gerrit2/gerrit2_lo/etc/log4j.properties
In log4j.properties section the appender and category must be activated:
See log4j manual for further infomration,
particularly appender and coonversation sections:
Another IRC session:
* don't use rolling file appender: Done.
* don't have ':' in timestamp: Done.
* Ensure that the timestamp is UTC: Done
Currently the log4j configuration is as follow:
and the result:
20131020 183427,230:davido:shell:/home/gerrit2/bin/say-hello --user davido --groups 'Administrators' -a foo bar
Released in the version 2.1 of plugin: