This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new c86a0405a5a [cleanup][build] Remove unused structured-event-log module 
(#25492)
c86a0405a5a is described below

commit c86a0405a5aaa3b27f659dd58f072874f2db5b2b
Author: Matteo Merli <[email protected]>
AuthorDate: Thu Apr 9 09:58:42 2026 -0700

    [cleanup][build] Remove unused structured-event-log module (#25492)
---
 pulsar-bom/build.gradle.kts                        |   1 -
 settings.gradle.kts                                |   1 -
 structured-event-log/build.gradle.kts              |  32 --
 .../apache/pulsar/structuredeventlog/Event.java    | 181 ---------
 .../pulsar/structuredeventlog/EventGroup.java      |  27 --
 .../pulsar/structuredeventlog/EventResources.java  |  52 ---
 .../structuredeventlog/EventResourcesImpl.java     |  85 ----
 .../pulsar/structuredeventlog/Initializer.java     |  44 ---
 .../structuredeventlog/StructuredEventLog.java     |  89 -----
 .../structuredeventlog/log4j2/Log4j2Event.java     | 208 ----------
 .../log4j2/Log4j2StructuredEventLog.java           |  46 ---
 .../structuredeventlog/log4j2/package-info.java    |  19 -
 .../pulsar/structuredeventlog/package-info.java    |  19 -
 .../structuredeventlog/slf4j/Slf4jEvent.java       | 246 ------------
 .../slf4j/Slf4jStructuredEventLog.java             |  46 ---
 .../structuredeventlog/slf4j/package-info.java     |  19 -
 .../slf4j/StructuredEventLogTest.java              | 438 ---------------------
 17 files changed, 1553 deletions(-)

diff --git a/pulsar-bom/build.gradle.kts b/pulsar-bom/build.gradle.kts
index 317ddfa4512..060db049449 100644
--- a/pulsar-bom/build.gradle.kts
+++ b/pulsar-bom/build.gradle.kts
@@ -77,7 +77,6 @@ dependencies {
         api(project(":pulsar-client-tools"))
         api(project(":pulsar-client-tools-api"))
         api(project(":pulsar-opentelemetry"))
-        api(project(":structured-event-log"))
         api(project(":testmocks"))
 
         // Transaction
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 45847e44465..531914a1b42 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -73,7 +73,6 @@ include("bouncy-castle:bouncy-castle-bc")
 project(":bouncy-castle:bouncy-castle-bc").projectDir = 
file("bouncy-castle/bc")
 include("bouncy-castle:bcfips")
 include("pulsar-config-validation")
-include("structured-event-log")
 include("pulsar-client-api")
 
 // Tier 1
diff --git a/structured-event-log/build.gradle.kts 
b/structured-event-log/build.gradle.kts
deleted file mode 100644
index dd811ed15f4..00000000000
--- a/structured-event-log/build.gradle.kts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-plugins {
-    id("pulsar.public-java-library-conventions")
-}
-
-dependencies {
-    implementation(libs.slf4j.api)
-    compileOnly(libs.log4j.core)
-
-    testImplementation(libs.hamcrest)
-    testImplementation(libs.log4j.core)
-    testImplementation(libs.log4j.slf4j2.impl)
-    testImplementation(libs.jackson.databind)
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Event.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Event.java
deleted file mode 100644
index 21569a76da2..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Event.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
-
-/**
- * Structured Logged Event interface.
- *
- * This interface is used to add context information to the log event and 
eventually log.
- */
-public interface Event {
-    /**
-     * Create a new child event. The child event will inherit the trace ID of 
the event
-     * from which it was created. The child event parentId will be the ID of 
the event
-     * from which it was created.
-     * The child will inherit resources from its parent event, but not 
attributes.
-     *
-     * @return a new child event
-     */
-    Event newChildEvent();
-
-    /**
-     * Set the trace ID of the event. Normally this will be inherited from the 
parent
-     * event. In the case of a root event, the trace ID will be automatically 
generated.
-     * This method only needs to be used if a traceID has been received from 
elsewhere,
-     * such as from a user request.
-     * @param traceId the traceId
-     * @return this
-     */
-    Event traceId(String traceId);
-
-    /**
-     * Set the parent ID of the event. Normally this is set automatically for 
child events.
-     * For root events, it is normally empty unless provided by some other 
means, such
-     * as via a user request.
-     * @param parentId the parentId
-     * @return this
-     */
-    Event parentId(String parentId);
-
-    /**
-     * Mark this event as timed.
-     * Timed events will measure the duration between #timed() being called
-     * and logged being called. The duration will be in milliseconds.
-     *
-     * <pre>
-     * Event e = logger.newRootEvent().timed();
-     * // do something that takes time.
-     * e.log(Events.SOME_EVENT);
-     * </pre>
-     *
-     * @return this
-     */
-    Event timed();
-
-    /**
-     * Mark this event as sampled.
-     * Sampled events will only log once per specified duration.
-     * The sampling key is used to scope the rate limit. All events using the
-     * same sampling key will observe the same rate limit.
-     * Sampled events are most useful in the data plane, where, if there is an
-     * error for one event, there's likely to be a lot of other events which 
are
-     * almost identical.
-     *
-     * @param samplingKey a key by which to scope the rate limiting
-     * @param duration the duration for which one event will be logged
-     * @param unit the duration unit
-     * @return this
-     */
-    Event sampled(Object samplingKey, int duration, TimeUnit unit);
-
-    /**
-     * Add resources for the event from an EventResources object.
-     * @see #resource(java.lang.String,java.lang.Object)
-     * @return this
-     */
-    Event resources(EventResources attrs);
-
-    /**
-     * Add a resource for the event. Resources are inherited by
-     * child events.
-     * @param key the key to identify the resource
-     * @param value the value which will be logged for the resource.
-     *        This is converted to a string before logging.
-     * @return this
-     */
-    Event resource(String key, Object value);
-
-    /**
-     * Add a resource for the event using a supplier. The supplier is
-     * used in the case that generating the string from the object is
-     * expensive or we want to generate a custom string.
-     * @param key the key to identify the resource
-     * @param value a supplier which returns the value to be logged for
-     *              this resource
-     * @see #resource(java.lang.String,java.lang.Object)
-     */
-    Event resource(String key, Supplier<String> value);
-
-    /**
-     * Add an attribute for the event. Attributes are not inherited
-     * by child events.
-     * @param key the key to identify the attribute
-     * @param value the value which will be logged for the attribute.
-     *        This is converted to a string, using Object#toString() before 
logging.
-     * @return this
-     */
-    Event attr(String key, Object value);
-
-    /**
-     * Add an attribute for the event using a supplier.
-     * @param key the key to identify the attribute
-     * @param value a supplier which returns the value to be logged for
-     *              this attribute
-     * @return this
-     */
-    Event attr(String key, Supplier<String> value);
-
-    /**
-     * Attach an exception to the event.
-     * @param t the exception
-     * @return this
-     */
-    Event exception(Throwable t);
-
-    /**
-     * Log this event at the error level.
-     * @return this
-     */
-    Event atError();
-
-    /**
-     * Log this event at the info level (the default).
-     * @return this
-     */
-    Event atInfo();
-
-    /**
-     * Log this event at the warn level.
-     * @return this
-     */
-    Event atWarn();
-
-    /**
-     * Log the event, using an enum as the message.
-     * Logging with a enum allows documentation and annotations, such as 
subcomponent
-     * to be attached to the message.
-     * @param event the event message, in enum form
-     */
-    void log(Enum<?> event);
-
-    /**
-     * Log the event, using a string.
-     * @param event the event message.
-     */
-    void log(String event);
-
-    /**
-     * Stash this log event to bridge across an unmodifiable API call.
-     * @see StructuredEventLog#unstash()
-     */
-    void stash();
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventGroup.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventGroup.java
deleted file mode 100644
index 0d76dd8ccec..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventGroup.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(value = RetentionPolicy.RUNTIME)
-public @interface EventGroup {
-    String component();
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResources.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResources.java
deleted file mode 100644
index 1605c1fe20d..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResources.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-import java.util.function.Supplier;
-
-/**
- * A container for resources
- * The container allows resources to be shared across multiple
- * events with different root events. An example usage of this would be used
- * for a server connection. We want all events initiated on the connection to
- * share resource values, such as remote and local socket. However, each root
- * event on the connection may be for a different trace.
- */
-public interface EventResources {
-    /**
-     * Add a resource for the event. Resources are inherited by
-     * child events.
-     * @param key the key to identify the resource
-     * @param value the value which will be logged for the resource.
-     *        This is converted to a string before logging.
-     * @return this
-     */
-    EventResources resource(String key, Object value);
-
-    /**
-     * Add a resource for the event using a supplier. The supplier is
-     * used in the case that generating the string from the object is
-     * expensive or we want to generate a custom string.
-     * @param key the key to identify the resource
-     * @param value a supplier which returns the value to be logged for
-     *              this resource
-     * @see #resource(java.lang.String,java.lang.Object)
-     */
-    EventResources resource(String key, Supplier<String> value);
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResourcesImpl.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResourcesImpl.java
deleted file mode 100644
index b2278933d7e..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/EventResourcesImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.BiConsumer;
-import java.util.function.Supplier;
-
-public class EventResourcesImpl implements EventResources {
-    private final EventResourcesImpl parent;
-    private List<Object> resources = null;
-
-    public EventResourcesImpl(EventResourcesImpl parent) {
-        this.parent = parent;
-    }
-
-    @Override
-    public EventResources resource(String key, Object value) {
-        getResources().add(key);
-        getResources().add(value);
-        return this;
-    }
-
-    @Override
-    public EventResources resource(String key, Supplier<String> value) {
-        resource(key, (Object) value);
-        return this;
-    }
-
-    public void copyFrom(EventResourcesImpl other) {
-        // can't use forEach because we want to avoid toString at this point
-        List<Object> resources = getResources();
-        if (other.parent != null) {
-            copyFrom(other.parent);
-        }
-
-        if (other.resources != null) {
-            resources.addAll(other.resources);
-        }
-    }
-
-    public void forEach(BiConsumer<String, String> process) {
-        if (parent != null) {
-            parent.forEach(process);
-        }
-        if (resources != null) {
-            forEach(resources, process);
-        }
-    }
-
-    private List<Object> getResources() {
-        if (resources == null) {
-            resources = new ArrayList<>(2);
-        }
-        return resources;
-    }
-
-    public static void forEach(List<Object> list, BiConsumer<String, String> 
process) {
-        for (int i = 0; i < list.size() - 1; i += 2) {
-            String key = String.valueOf(list.get(i));
-            Object value = list.get(i + 1);
-            if (value instanceof Supplier) {
-                value = ((Supplier<?>) value).get();
-            }
-            process.accept(key, String.valueOf(value));
-        }
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Initializer.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Initializer.java
deleted file mode 100644
index bb78c21e756..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/Initializer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-import org.apache.pulsar.structuredeventlog.log4j2.Log4j2StructuredEventLog;
-import org.apache.pulsar.structuredeventlog.slf4j.Slf4jStructuredEventLog;
-
-class Initializer {
-    static StructuredEventLog get() {
-        return INSTANCE;
-    }
-
-    private static final StructuredEventLog INSTANCE;
-
-    static {
-        StructuredEventLog log = null;
-        try {
-            // Use Log4j2 if available in the classpath
-            Class.forName("org.apache.logging.log4j.LogManager");
-            log = Log4j2StructuredEventLog.INSTANCE;
-        } catch (Throwable t) {
-            // Fallback to Slf4j otherwise
-            log = Slf4jStructuredEventLog.INSTANCE;
-        }
-
-        INSTANCE = log;
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/StructuredEventLog.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/StructuredEventLog.java
deleted file mode 100644
index 30e6e417f04..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/StructuredEventLog.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
-
-/**
- * Structured event logging interface
- *
- * Allows resources and attribute key value pairs to be attached to a logged 
event.
- *
- * Basic usage:
- * <pre>
- * StructuredEventLog logger = StructuredEventLog.newLogger();
- * logger.newRootEvent()
- *     .resource("remote", remoteAddr)
- *     .resource("local", localAddr)
- *     .attr("path", request.getPath())
- *     .log(Events.READ_REQUEST);
- * </pre>
- */
-public interface StructuredEventLog {
-    /**
-     * Create a new root event. Root events occur in response to some external 
stimulus, such as
-     * a user request, a timer being triggered or a threshold being crossed.
-     *
-     * The level of the event is INFO by default.
-     *
-     * The root event will generate a new traceId, and will have a empty 
parent Id. If this
-     * information is provided, as can be the case with a user request, they 
can be set
-     * with Event#traceId(String) and Event#parentId(String).
-     */
-    Event newRootEvent();
-
-    /**
-     * Create an new event resources object, which can be used across multiple
-     * root events.
-     */
-    EventResources newEventResources();
-
-    /**
-     * Retrieves an event from the call stack. This can be used, along with 
Event#stash(),
-     * to bridge an event across an API without having to modify the API to 
pass the event
-     * object.
-     *
-     * For example, the child event, METHOD2, in the following example, will 
share the traceId
-     * with METHOD1, and METHOD1's id will be match the parentId of METHOD2.
-     *
-     * <pre>
-     * void method1() {
-     *    Event e = logger.newRootEvent()
-     *        .timed()
-     *        .resource("foo", bar);
-     *
-     *    e.stash();
-     *    unmodifiableMethod();
-     *    e.log(Events.METHOD1);
-     * }
-     *
-     * void unmodifiableMethod() {
-     *    logger.unstash().newChildEvent().log(Events.METHOD2);
-     * }
-     * </pre>
-     *
-     * This should be used sparingly.
-     */
-    Event unstash();
-
-    /**
-     * Create a new logger object, from which root events can be created.
-     */
-    static StructuredEventLog get() {
-        return Initializer.get();
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2Event.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2Event.java
deleted file mode 100644
index 187d2064b38..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2Event.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.log4j2;
-
-import java.time.Clock;
-import java.time.Duration;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.message.StringMapMessage;
-import org.apache.pulsar.structuredeventlog.Event;
-import org.apache.pulsar.structuredeventlog.EventResources;
-import org.apache.pulsar.structuredeventlog.EventResourcesImpl;
-
-class Log4j2Event implements Event {
-    private static final Logger stringLogger = LogManager.getLogger();
-
-    private final Clock clock;
-    private String traceId = null;
-    private String parentId = null;
-    private List<Object> attributes = null;
-    private Level level = Level.INFO;
-    private Throwable throwable = null;
-    private Instant startTime = null;
-    private final EventResourcesImpl resources;
-
-    Log4j2Event(Clock clock, EventResourcesImpl parentResources) {
-        this.clock = clock;
-        this.resources = new EventResourcesImpl(parentResources);
-    }
-
-    @Override
-    public Event newChildEvent() {
-        return new Log4j2Event(clock, resources).traceId(traceId);
-    }
-
-    @Override
-    public Event traceId(String traceId) {
-        this.traceId = traceId;
-        return this;
-    }
-
-    @Override
-    public Event parentId(String parentId) {
-        this.parentId = parentId;
-        return this;
-    }
-
-    @Override
-    public Event timed() {
-        startTime = clock.instant();
-        return this;
-    }
-
-    @Override
-    public Event sampled(Object samplingKey, int duration, TimeUnit unit) {
-        throw new UnsupportedOperationException("TODO");
-    }
-
-    @Override
-    public Event resources(EventResources other) {
-        if (other instanceof EventResourcesImpl) {
-            this.resources.copyFrom((EventResourcesImpl) other);
-        }
-        return this;
-    }
-
-    @Override
-    public Event resource(String key, Object value) {
-        resources.resource(key, value);
-        return this;
-    }
-
-    @Override
-    public Event resource(String key, Supplier<String> value) {
-        resources.resource(key, value);
-        return this;
-    }
-
-    @Override
-    public Event attr(String key, Object value) {
-        getAttributes().add(key);
-        getAttributes().add(value);
-        return this;
-    }
-
-    @Override
-    public Event attr(String key, Supplier<String> value) {
-        this.attr(key, (Object) value);
-        return this;
-    }
-
-    @Override
-    public Event exception(Throwable t) {
-        this.throwable = t;
-        return this;
-    }
-
-    @Override
-    public Event atError() {
-        this.level = Level.ERROR;
-        return this;
-    }
-
-    @Override
-    public Event atInfo() {
-        this.level = Level.INFO;
-        return this;
-    }
-
-    @Override
-    public Event atWarn() {
-        this.level = Level.WARN;
-        return this;
-    }
-
-    @Override
-    public void log(Enum<?> event) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void log(String event) {
-        logInternal(stringLogger, event);
-    }
-
-    private void logInternal(Logger logger, String msg) {
-        StringMapMessage event = new StringMapMessage();
-        event.with("msg", msg);
-        if (traceId != null) {
-            event.with("traceId", traceId);
-        }
-        if (parentId != null) {
-            event.with("parentId", parentId);
-        }
-        resources.forEach(event::with);
-        if (attributes != null) {
-            EventResourcesImpl.forEach(attributes, event::with);
-        }
-        if (startTime != null) {
-            event.with("startTimestamp", startTime.toString());
-            event.with("durationMs", 
String.valueOf(Duration.between(startTime, clock.instant()).toMillis()));
-        }
-        switch (level) {
-            case ERROR:
-                if (throwable != null) {
-
-                    logger.error(event, throwable);
-                } else {
-                    logger.error(event);
-                }
-                break;
-            case WARN:
-                if (throwable != null) {
-                    logger.warn(event, throwable);
-                } else {
-                    logger.warn(event);
-                }
-                break;
-            case INFO:
-            default:
-                if (throwable != null) {
-                    logger.info(event, throwable);
-                } else {
-                    logger.info(event);
-                }
-                break;
-        }
-    }
-
-    @Override
-    public void stash() {
-        throw new UnsupportedOperationException("TODO");
-    }
-
-    private List<Object> getAttributes() {
-        if (attributes == null) {
-            attributes = new ArrayList<>();
-        }
-        return attributes;
-    }
-
-    enum Level {
-        INFO,
-        WARN,
-        ERROR
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2StructuredEventLog.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2StructuredEventLog.java
deleted file mode 100644
index e854a814e14..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/Log4j2StructuredEventLog.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.log4j2;
-
-import java.time.Clock;
-import org.apache.pulsar.structuredeventlog.Event;
-import org.apache.pulsar.structuredeventlog.EventResources;
-import org.apache.pulsar.structuredeventlog.EventResourcesImpl;
-import org.apache.pulsar.structuredeventlog.StructuredEventLog;
-
-public class Log4j2StructuredEventLog implements StructuredEventLog {
-    public static final Log4j2StructuredEventLog INSTANCE = new 
Log4j2StructuredEventLog();
-    // Visible for testing
-    Clock clock = Clock.systemUTC();
-
-    @Override
-    public Event newRootEvent() {
-        return new Log4j2Event(clock, null);
-    }
-
-    @Override
-    public EventResources newEventResources() {
-        return new EventResourcesImpl(null);
-    }
-
-    @Override
-    public Event unstash() {
-        throw new UnsupportedOperationException("TODO");
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/package-info.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/package-info.java
deleted file mode 100644
index c784880755a..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/log4j2/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.log4j2;
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/package-info.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/package-info.java
deleted file mode 100644
index 5450299d951..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog;
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jEvent.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jEvent.java
deleted file mode 100644
index 56cc6830926..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jEvent.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.slf4j;
-
-import java.time.Clock;
-import java.time.Duration;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
-import org.apache.pulsar.structuredeventlog.Event;
-import org.apache.pulsar.structuredeventlog.EventGroup;
-import org.apache.pulsar.structuredeventlog.EventResources;
-import org.apache.pulsar.structuredeventlog.EventResourcesImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-class Slf4jEvent implements Event {
-    private static final ThreadLocal<Map<Object, Logger>> loggersTLS = 
ThreadLocal.withInitial(() -> new HashMap<>());
-    private static final Logger stringLogger = 
LoggerFactory.getLogger("stevlog");
-
-    private final String id;
-    private final Clock clock;
-    private String traceId = null;
-    private String parentId = null;
-    private List<Object> attributes = null;
-    private Level level = Level.INFO;
-    private Throwable throwable = null;
-    private Instant startTime = null;
-    private final EventResourcesImpl resources;
-
-    Slf4jEvent(Clock clock, EventResourcesImpl parentResources) {
-        this.id = randomId();
-        this.clock = clock;
-        this.resources = new EventResourcesImpl(parentResources);
-    }
-
-    @Override
-    public Event newChildEvent() {
-        return new Slf4jEvent(clock, resources).traceId(traceId).parentId(id);
-    }
-
-    @Override
-    public Event traceId(String traceId) {
-        this.traceId = traceId;
-        return this;
-    }
-
-    @Override
-    public Event parentId(String parentId) {
-        this.parentId = parentId;
-        return this;
-    }
-
-    @Override
-    public Event timed() {
-        startTime = clock.instant();
-        return this;
-    }
-
-    @Override
-    public Event sampled(Object samplingKey, int duration, TimeUnit unit) {
-        throw new UnsupportedOperationException("TODO");
-    }
-
-    @Override
-    public Event resources(EventResources other) {
-        if (other instanceof EventResourcesImpl) {
-            this.resources.copyFrom((EventResourcesImpl) other);
-        }
-        return this;
-    }
-
-    @Override
-    public Event resource(String key, Object value) {
-        resources.resource(key, value);
-        return this;
-    }
-
-    @Override
-    public Event resource(String key, Supplier<String> value) {
-        resources.resource(key, value);
-        return this;
-    }
-
-    @Override
-    public Event attr(String key, Object value) {
-        getAttributes().add(key);
-        getAttributes().add(value);
-        return this;
-    }
-
-    @Override
-    public Event attr(String key, Supplier<String> value) {
-        this.attr(key, (Object) value);
-        return this;
-    }
-
-    @Override
-    public Event exception(Throwable t) {
-        this.throwable = t;
-        return this;
-    }
-
-    @Override
-    public Event atError() {
-        this.level = Level.ERROR;
-        return this;
-    }
-
-    @Override
-    public Event atInfo() {
-        this.level = Level.INFO;
-        return this;
-    }
-
-    @Override
-    public Event atWarn() {
-        this.level = Level.WARN;
-        return this;
-    }
-
-    @Override
-    public void log(Enum<?> event) {
-        EventGroup g = event.getClass().getAnnotation(EventGroup.class);
-        Map<Object, Logger> loggers = loggersTLS.get();
-        Logger logger;
-        if (g != null) {
-            String component = g.component();
-            MDC.put("component", component);
-            // do get, then compute to avoid alloc for compute supplier
-            logger = loggers.get(event);
-            if (logger == null) {
-                logger = loggers.compute(event,
-                        (k, v) -> LoggerFactory.getLogger(
-                                new StringBuilder("stevlog.").append(component)
-                                .append(".").append(event).toString()));
-            }
-        } else {
-            logger = loggers.get(event);
-            if (logger == null) {
-                logger = loggers.compute(event,
-                        (k, v) -> LoggerFactory.getLogger(
-                                new 
StringBuilder("stevlog.").append(event).toString()));
-            }
-        }
-        logInternal(logger, event.toString());
-    }
-
-    @Override
-    public void log(String event) {
-        logInternal(stringLogger, event);
-    }
-
-    private void logInternal(Logger logger, String event) {
-        try {
-            MDC.put("id", id);
-            if (traceId != null) {
-                MDC.put("traceId", traceId);
-            }
-            if (parentId != null) {
-                MDC.put("parentId", parentId);
-            }
-            resources.forEach(MDC::put);
-            if (attributes != null) {
-                EventResourcesImpl.forEach(attributes, MDC::put);
-            }
-            if (startTime != null) {
-                MDC.put("startTimestamp", startTime.toString());
-                MDC.put("durationMs", 
String.valueOf(Duration.between(startTime, clock.instant()).toMillis()));
-            }
-            switch (level) {
-            case ERROR:
-                if (throwable != null) {
-                    logger.error(event, throwable);
-                } else {
-                    logger.error(event);
-                }
-                break;
-            case WARN:
-                if (throwable != null) {
-                    logger.warn(event, throwable);
-                } else {
-                    logger.warn(event);
-                }
-                break;
-            case INFO:
-            default:
-                if (throwable != null) {
-                    logger.info(event, throwable);
-                } else {
-                    logger.info(event);
-                }
-                break;
-            }
-        } finally {
-            MDC.clear();
-        }
-    }
-
-    @Override
-    public void stash() {
-        throw new UnsupportedOperationException("TODO");
-    }
-
-    private List<Object> getAttributes() {
-        if (attributes == null) {
-            attributes = new ArrayList<>();
-        }
-        return attributes;
-    }
-
-    static String randomId() {
-        return Long.toString(
-                ThreadLocalRandom.current().nextLong(0x100000000000000L,
-                                                     0xFFFFFFFFFFFFFFFL),
-                16);
-    }
-
-    enum Level {
-        INFO,
-        WARN,
-        ERROR
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jStructuredEventLog.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jStructuredEventLog.java
deleted file mode 100644
index 1a94f5a4a29..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jStructuredEventLog.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.slf4j;
-
-import java.time.Clock;
-import org.apache.pulsar.structuredeventlog.Event;
-import org.apache.pulsar.structuredeventlog.EventResources;
-import org.apache.pulsar.structuredeventlog.EventResourcesImpl;
-import org.apache.pulsar.structuredeventlog.StructuredEventLog;
-
-public class Slf4jStructuredEventLog implements StructuredEventLog {
-    public static final Slf4jStructuredEventLog INSTANCE = new 
Slf4jStructuredEventLog();
-    // Visible for testing
-    Clock clock = Clock.systemUTC();
-
-    @Override
-    public Event newRootEvent() {
-        return new Slf4jEvent(clock, null).traceId(Slf4jEvent.randomId());
-    }
-
-    @Override
-    public EventResources newEventResources() {
-        return new EventResourcesImpl(null);
-    }
-
-    @Override
-    public Event unstash() {
-        throw new UnsupportedOperationException("TODO");
-    }
-}
diff --git 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/package-info.java
 
b/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/package-info.java
deleted file mode 100644
index 5e677a102ef..00000000000
--- 
a/structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.slf4j;
diff --git 
a/structured-event-log/src/test/java/org/apache/pulsar/structuredeventlog/slf4j/StructuredEventLogTest.java
 
b/structured-event-log/src/test/java/org/apache/pulsar/structuredeventlog/slf4j/StructuredEventLogTest.java
deleted file mode 100644
index e7d5393016d..00000000000
--- 
a/structured-event-log/src/test/java/org/apache/pulsar/structuredeventlog/slf4j/StructuredEventLogTest.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.structuredeventlog.slf4j;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.nullValue;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.BufferedReader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.appender.WriterAppender;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.LoggerConfig;
-import org.apache.logging.log4j.core.layout.JsonLayout;
-import org.apache.pulsar.structuredeventlog.Event;
-import org.apache.pulsar.structuredeventlog.EventGroup;
-import org.apache.pulsar.structuredeventlog.EventResources;
-import org.apache.pulsar.structuredeventlog.StructuredEventLog;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class StructuredEventLogTest {
-    private static final String APPENDER_NAME = "stevlogtest";
-    StringWriter writer;
-
-    @BeforeMethod
-    public void setupLog4j() throws Exception {
-        LoggerContext context = LoggerContext.getContext(false);
-        Configuration config = context.getConfiguration();
-
-        writer = new StringWriter();
-
-
-        LoggerConfig logConfig = config.getLoggerConfig(APPENDER_NAME);
-        for (Map.Entry<String, Appender> a : 
logConfig.getAppenders().entrySet()) {
-            if (a.getKey().equals(APPENDER_NAME)) {
-                a.getValue().stop();
-            }
-        }
-        logConfig.removeAppender(APPENDER_NAME);
-
-        JsonLayout layout = 
JsonLayout.newBuilder().setEventEol(true).setCompact(true).setProperties(true).build();
-        Appender appender = WriterAppender.createAppender(layout, null, 
writer, "stevlogtest", false, true);
-        appender.start();
-        logConfig.addAppender(appender, null, null);
-        logConfig.setLevel(Level.DEBUG);
-    }
-
-    @Test
-    public void testTraceId() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        Event e = log.newRootEvent();
-        e.newChildEvent().log("child");
-        e.log("parent");
-
-        log.newRootEvent().log("second");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("child"));
-        assertThat(logged.get(1).get("message"), equalTo("parent"));
-        assertThat(logged.get(2).get("message"), equalTo("second"));
-
-        assertThat(contextMapField(logged.get(0), "traceId"),
-                   equalTo(contextMapField(logged.get(1), "traceId")));
-        assertThat(contextMapField(logged.get(0), "traceId"),
-                   not(equalTo(contextMapField(logged.get(2), "traceId"))));
-    }
-
-    @Test
-    public void testParentId() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        Event e1 = log.newRootEvent();
-        Event e2 = e1.newChildEvent();
-        e2.newChildEvent().log("child2");
-        e2.log("child1");
-        e1.log("parent");
-
-        log.newRootEvent().log("second");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("child2"));
-        assertThat(logged.get(1).get("message"), equalTo("child1"));
-        assertThat(logged.get(2).get("message"), equalTo("parent"));
-        assertThat(logged.get(3).get("message"), equalTo("second"));
-
-        assertThat(contextMapField(logged.get(0), "parentId"), 
not(nullValue()));
-        assertThat(contextMapField(logged.get(0), "parentId"),
-                   equalTo(contextMapField(logged.get(1), "id")));
-        assertThat(contextMapField(logged.get(1), "parentId"),
-                   equalTo(contextMapField(logged.get(2), "id")));
-        assertThat(contextMapField(logged.get(2), "parentId"), nullValue());
-        assertThat(contextMapField(logged.get(3), "parentId"), nullValue());
-    }
-
-    @Test
-    public void testResources() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        EventResources res = log.newEventResources()
-            .resource("r1", "v1")
-            .resource("r2", () -> "v2");
-        Event e1 = log.newRootEvent()
-            .resources(res)
-            .resource("r3", "v3")
-            .resource("r4", () -> "v4");
-        Event e2 = e1.newChildEvent().resource("r5", "v5");
-        e2.newChildEvent().resource("r6", "v6").log("child2");
-        e2.log("child1");
-        e1.log("parent");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("child2"));
-        assertThat(logged.get(1).get("message"), equalTo("child1"));
-        assertThat(logged.get(2).get("message"), equalTo("parent"));
-
-        assertThat(contextMapField(logged.get(0), "r6"), equalTo("v6"));
-        assertThat(contextMapField(logged.get(0), "r5"), equalTo("v5"));
-        assertThat(contextMapField(logged.get(0), "r4"), equalTo("v4"));
-        assertThat(contextMapField(logged.get(0), "r3"), equalTo("v3"));
-        assertThat(contextMapField(logged.get(0), "r2"), equalTo("v2"));
-        assertThat(contextMapField(logged.get(0), "r1"), equalTo("v1"));
-
-        assertThat(contextMapField(logged.get(1), "r6"), nullValue());
-        assertThat(contextMapField(logged.get(1), "r5"), equalTo("v5"));
-        assertThat(contextMapField(logged.get(1), "r4"), equalTo("v4"));
-        assertThat(contextMapField(logged.get(1), "r3"), equalTo("v3"));
-        assertThat(contextMapField(logged.get(1), "r2"), equalTo("v2"));
-        assertThat(contextMapField(logged.get(1), "r1"), equalTo("v1"));
-
-        assertThat(contextMapField(logged.get(2), "r6"), nullValue());
-        assertThat(contextMapField(logged.get(2), "r5"), nullValue());
-        assertThat(contextMapField(logged.get(2), "r4"), equalTo("v4"));
-        assertThat(contextMapField(logged.get(2), "r3"), equalTo("v3"));
-        assertThat(contextMapField(logged.get(2), "r2"), equalTo("v2"));
-        assertThat(contextMapField(logged.get(2), "r1"), equalTo("v1"));
-    }
-
-    @Test
-    public void testResourcesNullTest() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        EventResources res = log.newEventResources()
-            .resource(null, "v1")
-            .resource("r1", null)
-            .resource("r2", () -> null);
-        Event e1 = log.newRootEvent()
-            .resources(res)
-            .resource(null, "v2")
-            .resource("r3", null)
-            .resource("r4", () -> null);
-        e1.newChildEvent()
-            .resource(null, "v3")
-            .resource("r5", null)
-            .log("child1");
-        e1.log("parent");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("child1"));
-        assertThat(logged.get(1).get("message"), equalTo("parent"));
-
-        assertThat(contextMapField(logged.get(0), "r5"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "r4"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "r3"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "r2"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "r1"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "null"), equalTo("v3"));
-
-        assertThat(contextMapField(logged.get(1), "r5"), nullValue());
-        assertThat(contextMapField(logged.get(1), "r4"), equalTo("null"));
-        assertThat(contextMapField(logged.get(1), "r3"), equalTo("null"));
-        assertThat(contextMapField(logged.get(1), "r2"), equalTo("null"));
-        assertThat(contextMapField(logged.get(1), "r1"), equalTo("null"));
-        assertThat(contextMapField(logged.get(1), "null"), equalTo("v2"));
-    }
-
-    @Test
-    public void testAttributes() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        Event e1 = log.newRootEvent()
-            .attr("a1", "v1")
-            .attr("a2", () -> "v2");
-        Event e2 = e1.newChildEvent().attr("a3", "v3");
-        e2.newChildEvent().resource("a4", "v4").log("child2");
-        e2.log("child1");
-        e1.log("parent");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("child2"));
-        assertThat(logged.get(1).get("message"), equalTo("child1"));
-        assertThat(logged.get(2).get("message"), equalTo("parent"));
-
-        assertThat(contextMapField(logged.get(0), "a4"), equalTo("v4"));
-        assertThat(contextMapField(logged.get(0), "a3"), nullValue());
-        assertThat(contextMapField(logged.get(0), "a2"), nullValue());
-        assertThat(contextMapField(logged.get(0), "a1"), nullValue());
-
-        assertThat(contextMapField(logged.get(1), "a4"), nullValue());
-        assertThat(contextMapField(logged.get(1), "a3"), equalTo("v3"));
-        assertThat(contextMapField(logged.get(1), "a2"), nullValue());
-        assertThat(contextMapField(logged.get(1), "a1"), nullValue());
-
-        assertThat(contextMapField(logged.get(2), "a4"), nullValue());
-        assertThat(contextMapField(logged.get(2), "a3"), nullValue());
-        assertThat(contextMapField(logged.get(2), "a2"), equalTo("v2"));
-        assertThat(contextMapField(logged.get(2), "a1"), equalTo("v1"));
-    }
-
-    @Test
-    public void testAttributedNullTest() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent()
-            .attr(null, "v1")
-            .attr("a1", null)
-            .attr("a2", () -> null)
-            .log("msg");
-
-        log.newRootEvent()
-            .attr(null, "v1")
-            .attr("a1", null)
-            .attr("a2", () -> null)
-            .log("msg");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("msg"));
-
-        assertThat(contextMapField(logged.get(0), "null"), equalTo("v1"));
-        assertThat(contextMapField(logged.get(0), "a1"), equalTo("null"));
-        assertThat(contextMapField(logged.get(0), "a2"), equalTo("null"));
-    }
-
-    @Test
-    public void testInfoLevel() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().log("info1");
-        log.newRootEvent().atInfo().log("info2");
-        log.newRootEvent().atError().atInfo().log("info3");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("info1"));
-        assertThat(logged.get(1).get("message"), equalTo("info2"));
-        assertThat(logged.get(2).get("message"), equalTo("info3"));
-
-        assertThat(logged.get(0).get("level"), equalTo("INFO"));
-        assertThat(logged.get(1).get("level"), equalTo("INFO"));
-        assertThat(logged.get(2).get("level"), equalTo("INFO"));
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testInfoLevelException() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().exception(new Throwable("cause1")).log("info1");
-        log.newRootEvent().atInfo().exception(new 
Throwable("cause2")).log("info2");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("info1"));
-
-        assertThat(((Map<String, Object>) 
logged.get(0).get("thrown")).get("message"), equalTo("cause1"));
-        assertThat(logged.get(1).get("message"), equalTo("info2"));
-        assertThat(((Map<String, Object>) 
logged.get(1).get("thrown")).get("message"), equalTo("cause2"));
-    }
-
-    @Test
-    public void testWarnLevel() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().atWarn().log("warn1");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("warn1"));
-        assertThat(logged.get(0).get("level"), equalTo("WARN"));
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testWarnLevelException() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().atWarn().exception(new 
Throwable("cause1")).log("warn1");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("warn1"));
-        assertThat(((Map<String, Object>) 
logged.get(0).get("thrown")).get("message"), equalTo("cause1"));
-    }
-
-    @Test
-    public void testErrorLevel() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().atError().log("error1");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("error1"));
-        assertThat(logged.get(0).get("level"), equalTo("ERROR"));
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testErrorLevelException() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-
-        log.newRootEvent().atError().exception(new 
Throwable("cause1")).log("error1");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("error1"));
-        assertThat(((Map<String, Object>) 
logged.get(0).get("thrown")).get("message"), equalTo("cause1"));
-    }
-
-
-    @Test
-    public void testTimedEvent() throws Exception {
-        MockClock clock = new MockClock();
-        Slf4jStructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-        log.clock = clock;
-        Event e = log.newRootEvent().timed();
-        clock.advanceTime(1234, TimeUnit.MILLISECONDS);
-        e.log("timed");
-
-        List<Map<String, Object>> logged = getLogged();
-        assertThat(logged.get(0).get("message"), equalTo("timed"));
-        assertThat(contextMapField(logged.get(0), "startTimestamp"), 
equalTo("1970-01-02T03:46:40Z"));
-        assertThat(contextMapField(logged.get(0), "durationMs"), 
equalTo("1234"));
-    }
-
-    @EventGroup(component = "foobar")
-    public enum Events {
-        TEST_EVENT
-    }
-
-    @Test
-    public void testEventGroups() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-        log.newRootEvent().log(Events.TEST_EVENT);
-
-        List<Map<String, Object>> logged = getLogged();
-        System.out.println(logged);
-        assertThat(logged.get(0).get("message"), equalTo("TEST_EVENT"));
-        assertThat(logged.get(0).get("loggerName"), 
equalTo("stevlog.foobar.TEST_EVENT"));
-        assertThat(contextMapField(logged.get(0), "component"), 
equalTo("foobar"));
-    }
-
-    public enum BareEvents {
-        BARE_EVENT
-    }
-
-    @Test
-    public void testBareEnum() throws Exception {
-        StructuredEventLog log = Slf4jStructuredEventLog.INSTANCE;
-        log.newRootEvent().log(BareEvents.BARE_EVENT);
-
-        List<Map<String, Object>> logged = getLogged();
-        System.out.println(logged);
-        assertThat(logged.get(0).get("message"), equalTo("BARE_EVENT"));
-        assertThat(logged.get(0).get("loggerName"), 
equalTo("stevlog.BARE_EVENT"));
-        assertThat(contextMapField(logged.get(0), "component"), nullValue());
-    }
-
-    @SuppressWarnings("unchecked")
-    private Object contextMapField(Map<String, Object> map, String field) {
-        return ((Map<String, Object>) map.get("contextMap")).get(field);
-    }
-
-    @SuppressWarnings("unchecked")
-    private List<Map<String, Object>> getLogged() throws Exception {
-        List<Map<String, Object>> logged = new ArrayList<>();
-        ObjectMapper o = new ObjectMapper();
-        try (BufferedReader r = new BufferedReader(new 
StringReader(writer.toString()))) {
-            String line = r.readLine();
-            while (line != null) {
-                Map<String, Object> log = o.readValue(line, Map.class);
-                if (log.get("loggerName").toString().startsWith("stevlog")) {
-                    logged.add(log);
-                }
-                line = r.readLine();
-            }
-        }
-        return logged;
-    }
-
-    private static class MockClock extends Clock {
-        AtomicLong ticker = new AtomicLong(100000000);
-
-        void advanceTime(int duration, TimeUnit unit) {
-            ticker.addAndGet(unit.toMillis(duration));
-        }
-
-        @Override
-        public Instant instant() {
-            return Instant.ofEpochMilli(ticker.get());
-        }
-
-        @Override
-        public ZoneId getZone() {
-            return ZoneId.of("UTC");
-        }
-
-        @Override
-        public Clock withZone(ZoneId zoneId) {
-            return this;
-        }
-    }
-}
-

Reply via email to