Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void setUp() throws Exception {
@After
public void tearDown() {
try {
LogCustomizer customizer = LogCustomizer.forLogger(AzureBlobContainerProvider.class.getName())
LogCustomizer customizer = LogCustomizer.forLogger(AzureBlobContainerProvider.class)
.filter(Level.INFO)
.create();
customizer.starting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicReference;

import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
Expand Down Expand Up @@ -86,6 +85,7 @@
import org.mockito.internal.util.collections.Iterables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;

/**
* Generic class for BlobGC tests which uses custom MemoryNodeStore as well as a memory NodeStore.
Expand Down Expand Up @@ -534,7 +534,7 @@ public void gcCheckDeletedSize() throws Exception {

// Capture logs for the second round of gc
LogCustomizer customLogs = LogCustomizer
.forLogger(MarkSweepGarbageCollector.class.getName())
.forLogger(MarkSweepGarbageCollector.class)
.enable(Level.INFO)
.filter(Level.INFO)
.contains("Estimated size recovered for")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import ch.qos.logback.classic.Level;

import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.core.data.DataStoreException;
import org.apache.jackrabbit.oak.commons.FileIOUtils;
Expand All @@ -60,6 +58,7 @@
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -691,7 +690,7 @@ public void testUpgradeCompromisedSerializedMap() throws IOException {
File pendingUploadsFile = new File(home, DataStoreCacheUpgradeUtils.UPLOAD_MAP);
createGibberishLoad(pendingUploadsFile);

LogCustomizer lc = LogCustomizer.forLogger(DataStoreCacheUpgradeUtils.class.getName())
LogCustomizer lc = LogCustomizer.forLogger(DataStoreCacheUpgradeUtils.class)
.filter(Level.WARN)
.enable(Level.WARN)
.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,11 @@ private LogCustomizerBuilder(String name) {
this.name = name;
}

public LogCustomizerBuilder enable(Level level) {
this.enableLevel = level;
return this;
}

public LogCustomizerBuilder enable(org.slf4j.event.Level level) {
this.enableLevel = fromSlf4jLevel(level);
return this;
}

public LogCustomizerBuilder filter(Level level) {
this.filterLevel = level;
return this;
}

public LogCustomizerBuilder filter(org.slf4j.event.Level level) {
this.filterLevel = fromSlf4jLevel(level);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;
import org.slf4j.event.Level;

/**
* Tests for the LogCustomizer class
Expand Down Expand Up @@ -81,7 +80,7 @@ public void testLogs2() {
@Test
public void testExactMatch() {
LogCustomizer custom = LogCustomizer
.forLogger("org.apache.jackrabbit.oak.commons.junit.LogCustomizerTest")
.forLogger(org.apache.jackrabbit.oak.commons.junit.LogCustomizerTest.class)
.exactlyMatches("Test Message")
.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testString() {

@Test
public void testFilter() {
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class.getName()).enable(Level.ERROR)
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class).enable(Level.ERROR)
.contains("Ignoring invalid value").create();
logCustomizer.starting();

Expand All @@ -82,7 +82,7 @@ public void testFilter() {
@Test
public void testHidden() {
String secret = "secret123";
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class.getName()).enable(Level.TRACE)
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class).enable(Level.TRACE)
.contains(secret).create();
logCustomizer.starting();

Expand All @@ -99,7 +99,7 @@ public void testHidden() {

@Test
public void testNonParseable() {
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class.getName()).enable(Level.ERROR)
LogCustomizer logCustomizer = LogCustomizer.forLogger(SystemPropertySupplierTest.class).enable(Level.ERROR)
.contains("Ignoring malformed value").create();
logCustomizer.starting();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.event.Level;

import ch.qos.logback.classic.Level;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.MISSING_NODE;

public class AsyncIndexUpdateTest {
Expand Down Expand Up @@ -1403,7 +1403,7 @@ public void checkpointStability() throws Exception{
async.run();
//Now checkpoints = [checkpoints1]. Note that size is 1 so new checkpoint name remains same

LogCustomizer customLogs = LogCustomizer.forLogger(AsyncIndexUpdate.class.getName())
LogCustomizer customLogs = LogCustomizer.forLogger(AsyncIndexUpdate.class)
.filter(Level.WARN)
.create();

Expand Down Expand Up @@ -1670,7 +1670,7 @@ private void assertLogPhrase(List<String> logs, String logPhrase){
}

private static LogCustomizer createLogCustomizer(Level level){
LogCustomizer lc = LogCustomizer.forLogger(AsyncIndexUpdate.class.getName())
LogCustomizer lc = LogCustomizer.forLogger(AsyncIndexUpdate.class)
.filter(level)
.enable(level)
.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
Expand Down Expand Up @@ -85,6 +84,7 @@
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.event.Level;

public class IndexUpdateTest {

Expand Down Expand Up @@ -997,7 +997,7 @@ public void reindexForDisabledIndexes() throws Exception{
builder.getChildNode("oak:index").getChildNode("fooIndex").setProperty(REINDEX_PROPERTY_NAME, true);
after = builder.getNodeState();

LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class.getName()).filter(Level.INFO).create();
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class).filter(Level.INFO).create();
customLogs.starting();

before = after;
Expand All @@ -1017,7 +1017,7 @@ public void reindexForDisabledIndexes() throws Exception{
*/
@Test
public void testConfigErrorInIndexDefintion() throws Exception{
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class.getName()).enable(Level.ERROR).create();
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class).enable(Level.ERROR).create();
builder.child("testRoot").setProperty("foo", "abc");
//Create 2 index def - one with config related error and one without

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class IndexImporterTest {

@Before
public void setup(){
customizer = LogCustomizer.forLogger(IndexImporter.class.getName()).filter(Level.INFO).create();
customizer = LogCustomizer.forLogger(IndexImporter.class).filter(Level.INFO).create();
customizer.starting();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Test;

import ch.qos.logback.classic.Level;
import org.slf4j.event.Level;

public class OrderedPropertyIndexEditorProviderTest {
private final CommitHook hook = new EditorHook(new IndexUpdateProvider(
new OrderedPropertyIndexEditorProvider()));
private final LogCustomizer custom = LogCustomizer
.forLogger(OrderedPropertyIndexEditorProvider.class.getName()).enable(Level.WARN).create();
.forLogger(OrderedPropertyIndexEditorProvider.class).enable(Level.WARN).create();

private final String indexName = "mickey";
private final String indexedProperty = "mouse";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
import org.apache.jackrabbit.oak.query.AbstractQueryTest;
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
import org.junit.Test;

import ch.qos.logback.classic.Level;
import org.slf4j.event.Level;

public class OrderedPropertyIndexProviderTest extends AbstractQueryTest {
private final LogCustomizer custom = LogCustomizer
.forLogger(OrderedPropertyIndexProvider.class.getName()).enable(Level.WARN).create();
.forLogger(OrderedPropertyIndexProvider.class).enable(Level.WARN).create();

@Override
protected void createTestIndexNode() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@
import org.junit.Test;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.spi.FilterReply;

import org.slf4j.event.Level;

/**
* Test the Property2 index mechanism.
Expand Down Expand Up @@ -849,7 +848,7 @@ public void testPathIncludeExclude() throws Exception {

@Test
public void testPathExcludeInclude() throws Exception{
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class.getName()).enable(Level.ERROR).create();
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class).enable(Level.ERROR).create();
NodeState root = INITIAL_CONTENT;

// Add index definition
Expand Down Expand Up @@ -1143,7 +1142,7 @@ private static class TraversingWarningFilter extends ch.qos.logback.core.filter.

@Override
public FilterReply decide(ILoggingEvent event) {
if (event.getLevel().isGreaterOrEqual(Level.WARN)
if (event.getLevel().toInt() >= Level.WARN.toInt()
&& event.getMessage().contains("Traversed")) {
return FilterReply.ACCEPT;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void queryLengthErrorLimitBreachThrowsException() throws Exception {
public void queryLengthWarnLimitBreachLogsWarning() throws Exception {
String generatedString = RandomStringUtils.random(queryLengthWarnLimit, true, false);

LogCustomizer customLogs = LogCustomizer.forLogger(QueryEngineImpl.class.getName()).enable(Level.WARN).create();
LogCustomizer customLogs = LogCustomizer.forLogger(QueryEngineImpl.class).enable(Level.WARN).create();

try {
customLogs.starting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void warning() throws ParseException {
",\"executedLast\":\"\"\n" +
",\"executedCount\":0\n" +
"}]", v.getJson());
LogCustomizer customLogs = LogCustomizer.forLogger(QueryValidator.class.getName()).enable(Level.WARN).create();
LogCustomizer customLogs = LogCustomizer.forLogger(QueryValidator.class).enable(Level.WARN).create();
try {
customLogs.starting();
v.checkStatement("x1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected ContentRepository createRepository() {
*/
@Test
public void testSimilarCostIndices() throws Exception {
LogCustomizer customLogs = LogCustomizer.forLogger(QueryImpl.class.getName()).enable(Level.DEBUG).create();
LogCustomizer customLogs = LogCustomizer.forLogger(QueryImpl.class).enable(Level.DEBUG).create();

try {
customLogs.starting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.Set;
import java.util.concurrent.ScheduledFuture;

import ch.qos.logback.classic.Level;
import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
Expand Down Expand Up @@ -60,6 +59,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.event.Level;

import static java.lang.String.valueOf;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
Expand Down Expand Up @@ -484,7 +484,7 @@ private void clusterGCInternal(Cluster cluster1, Cluster cluster2, boolean same)

// Capture logs for the second round of gc
LogCustomizer customLogs = LogCustomizer
.forLogger(MarkSweepGarbageCollector.class.getName())
.forLogger(MarkSweepGarbageCollector.class)
.enable(Level.WARN)
.filter(Level.WARN)
.contains("Error occurred while deleting blob with id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void testInvalidNamespace() throws Exception {
final Root root = session.getLatestRoot();
NamespaceRegistry r = getNamespaceRegistry(session, root);

LogCustomizer customLogs = LogCustomizer.forLogger("org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry").enable(Level.ERROR).create();
LogCustomizer customLogs = LogCustomizer.forLogger(org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.class).enable(Level.ERROR).create();
try {
customLogs.starting();
r.registerNamespace("foo", "example.com");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak;

import ch.qos.logback.classic.Level;
import org.apache.jackrabbit.api.JackrabbitRepository;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
Expand All @@ -35,6 +34,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.event.Level;

import javax.jcr.Node;
import javax.jcr.Repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import ch.qos.logback.classic.Level;

import org.slf4j.event.Level;

@RunWith(Parameterized.class)
public class ConflictResolutionTest extends AbstractRepositoryTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void trivialUpdates() throws Exception {
ntt.add(nt);
}

logCustomizer = LogCustomizer.forLogger(TypeEditorProvider.class.getName()).enable(Level.INFO)
logCustomizer = LogCustomizer.forLogger(TypeEditorProvider.class).enable(Level.INFO)
.contains("appear to be trivial, repository will not be scanned").create();
try {
logCustomizer.starting();
Expand Down Expand Up @@ -254,7 +254,7 @@ public void trivialUpdates() throws Exception {
}
// but update both node types

logCustomizer = LogCustomizer.forLogger(TypeEditorProvider.class.getName()).enable(Level.INFO)
logCustomizer = LogCustomizer.forLogger(TypeEditorProvider.class).enable(Level.INFO)
.contains("appear not to be trivial, starting repository scan").create();
try {
logCustomizer.starting();
Expand Down
Loading
Loading