SLF4J Logger Setup Confluence Plugin

Bart Kerfeld July 6, 2015

I am trying to set up a logger to run with the linking plugin I created. From this website, it seems that the SLF4J Logger is the one I should use. So I set up the code as follows to test.

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... other imports

public class AnnotatedListener implements DisposableBean  {
	private static final Logger log = LoggerFactory.getLogger(AnnotatedListener.class);
    
    protected EventPublisher eventPublisher;
    
    public AnnotatedListener(EventPublisher eventPublisher, PageManager pageManager) {
        this.eventPublisher = eventPublisher;
        eventPublisher.register(this);
    }

	@EventListener
    public void pageCreateEvent(PageCreateEvent event) {
        log.info("PageCreateEvent Occured");
        processEvent(event.getPage());
    }
}

I am not getting any sort of response to a log that I know of. Is there some set up I am missing in an XML or properties file (cause I have done none)? I am looking at the atlassian-confluence.log file in %Confluence Home%\logs and not seeing my text added.

If you have any suggestions, I would appreciate it. Thanks for the help.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nelson Carranza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2015

Hi Bart,

You need to add your class in the Logging and Profiling screen https://confluence.atlassian.com/display/DOC/Configuring+Logging

However, this will be deleted after restarting. In the above link you will find instructions on how to make it permanent

 

Regards

Nelson

 

Bart Kerfeld July 6, 2015

Thanks! Worked for me though trying to edit the properties file is a real pain. I have closed confluence using the .bat file still it shows the file is being used by something else.

TAGS
AUG Leaders

Atlassian Community Events