Logging to atlassian-bitbucket.log from a Bitbucket plugin

I am trying to debug a plugin which doesn’t work in 8.0. I am wondering how to write log messages to atlassian-bitbucket.log from the plugin. I tried the logback option discussed here:

It didn’t make any difference however. I also tried to write logs to a different file altogether using this configuration:

    <appender name="filehook-plugin" class="ch.qos.logback.core.RollingFileAppender">
    <logger name="org.christiangalsterer.stash.filehooks.plugin.hook" level="INFO"/>

That also didn’t work.

I can recommend a solution that changes the log level of any package at runtime. Send a PUT request to BB REST API like so:

curl -u admin:admin -v -ikL -X PUT -d ""  -H "Content-Type: application/json" "http://localhost:7990/bitbucket/rest/api/latest/logs/logger/org.christiangalsterer.stash.filehooks.plugin.hook/debug"

To reset the package log level to INFO or WARN end the URL with .../info or .../warn or restart bitbucket.

Hope that helps.
Cheers Ulrich
// Izymes

1 Like

What worked for me was simply enabling Debug in the web UI:

With that change in place and using logback, messages logged at INFO level appeared in the atlassian-bitbucket.log file. I didn’t actually need the custom xml file at all.