package com.company.impl;
public class myclass {
private static final Logger log = LoggerFactory.getLogger(myclass.class);
public myclass(){
log.info("Constructed");
}
}
It feels like I’m missing something incredibly basic, but I can’t put my finger on it and “Bitbucket log4j.properties” is not giving me anything onhere or Google.
To enable debugging of your Bitbucket plugin using Logback:
Create the directory src/test/resources/bitbucket-home
Create a file src/test/resources/bitbucket-home/logback.xml [1] and add logger elements as desired, eg I have:
<included>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.format}</pattern>
</encoder>
</appender>
<!--When starting up Elasticsearch in-process (for dev):
We need to set the logging level of org.elasticsearch.bootstrap to ERROR because otherwise
it will log a misleading warning (with a stacktrace) about JNA being unavailable.-->
<logger name="org.elasticsearch.bootstrap" level="ERROR"/>
<logger name="com.declarativesystems" level="DEBUG"/>
<root>
<appender-ref ref="console"/>
</root>
</included>
atlas-clean && atlas-run as normal - you will now be able to see the logs from your plugin on the console.
Log4J
I’m using Bitbucket 5.16 which uses Logback. I couldn’t get log4j working at all:
Log4j 1.2 in pom.xml causes my whole plugin to fail:
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.declarativesystems.bitbucket.credentialscanner [126]: Unable to resolve 126.0: missing requirement [126.0] osgi.wiring.package; (osgi.wiring.package=com.ibm.uvm.tools)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
... 22 common frames omitted