Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
This feature is configured in two places, log4j2.xml
file and in auditLogging
configuration.
Here you define the loggers to be used by the audit logging. Here is an example extracted from the application log4j2.xml
:
<RollingFile name="sync-log-audit" fileName="${magnolia.logs.dir}/magnolia-audit.log" filePattern="${magnolia.logs.dir}/magnolia-audit-%i.log" append="true"> <PatternLayout pattern="%d{dd.MM.yyyy HH:mm:ss}%m%n"/> <Policies> <SizeBasedTriggeringPolicy size="1MB"/> </Policies> <DefaultRolloverStrategy max="5"/> </RollingFile> <Async name="log-audit"> <AppenderRef ref="sync-log-audit"/> </Async>
Define the actions you want to log in auditLogging
configuration. You can enable the preconfigured actions and define which logger they should use. Define separators for each action or use the default separator (comma) for all of them.
Node name | Value |
---|---|
server | |
auditLogging | |
logConfigurations | |
deactivate | |
activate | |
active | false |
logName | log-audit |
copy | |
login | |
logout | |
move | |
modify | |
create | |
delete | |
class | info.magnolia.audit.AuditLoggingManager |
defaultSeparator | , |
Below is an extract of the output of the logs. Format is: date, action performed, user ID, workspace, nodepath.
20.10.2008 11:59:33 , create , superuser , website , /untitled4
For actions move
and copy
it will add the original node path and the destination node path.
For actions login
and logout
the output differs. Date, user ID, action, and for login
also the IP and the result of the action are logged:
21.10.2008 12:21:59, logout, anonymous 21.10.2008 12:22:05, login, superuser, 127.0.0.1, Success