onEvent in Event Listener not firing


I’ve written an extension that wants to listen for the renaming of pages but for some reason the onEvent method is not being called.

I followed the “Writing an EventListener Tutorial” for a Java component. After that didn’t appear to work, I noticed that the code in the Tutorial is “Before 5.4” according to the Local Observation Module document so I switched to the example for “Since 5.4”, using the abstract class that’s provided. However, this did not fix the issue either.

I made my component Initializable and my initialize method is being called when the extension is installed via the Extension Manager so that would suggest (at least to me :slight_smile: ) that XWiki is recognising it as a valid component.

I’ve also installed the Event Listener Administration Application/Extension which does list my class as an event listener and for the right events.

Below is the simplest component I could put together. It’s listed in the Event Listener Administration app for the DocumentRenamingEvent and DocumentRenamedEvent events (so I think the components.txt file is correct).

It logs at error just to make as sure as I can that I’ll see the output in the logs.


import javax.inject.Inject;
import javax.inject.Named;
import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
import org.xwiki.component.phase.Initializable;
import org.xwiki.component.phase.InitializationException;
import org.xwiki.observation.AbstractEventListener;
import org.xwiki.observation.event.Event;
import org.xwiki.refactoring.event.DocumentRenamedEvent;
import org.xwiki.refactoring.event.DocumentRenamingEvent;

public class AlexEventListener extends AbstractEventListener implements Initializable {

    private Logger log;

    public AlexEventListener() {
        super("alexeventlistener", new DocumentRenamingEvent(), new DocumentRenamedEvent());

    public void onEvent(Event event, Object source, Object data) {

    public void initialize() throws InitializationException {
        log.error("alex init");


With that all in place, I then:

  1. Navigate to a page.
  2. Click the ellipsis menu
  3. Click “Move / Rename”
  4. Enter a new Title
  5. Click Rename
  6. The page (and its URL) appear to be successfully renamed but, no events are received in my listener.

Any suggestions?

Thanks in advance,

I’ve now been able to identify that onEvent is being called but for some reason the log output is being swallowed and not making it to the normal logs.

I’m running XWiki in a container (in Kubernetes) so I’m looking at the normal log output which appears to have worked fine for everything else (other extensions, etc.) it just seems that somehow log output from inside the onEvent method is not making to the normal output.

I found this out by using System outs in the onEvent method.

Is there something I can do to get Logger output to log as normal?

This is because those two events are triggered as part of a job, so your log is going in that job log. Take a look at for a way to force your log to go through to the general log no matter what.

Thank you @tmortagne!