[
https://issues.apache.org/jira/browse/LOG4J2-2280?focusedWorklogId=305953&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-305953
]
ASF GitHub Bot logged work on LOG4J2-2280:
------------------------------------------
Author: ASF GitHub Bot
Created on: 03/Sep/19 22:48
Start Date: 03/Sep/19 22:48
Worklog Time Spent: 10m
Work Description: sijie commented on pull request #158: [LOG4J2-2280]
Introduce an Apache Pulsar log4j appender
URL: https://github.com/apache/logging-log4j2/pull/158#discussion_r320509537
##########
File path:
log4j-pulsar/src/main/java/org/apache/logging/log4j/pulsar/appender/PulsarAppender.java
##########
@@ -0,0 +1,211 @@
+/**
+ * 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.logging.log4j.pulsar.appender;
+
+import java.io.Serializable;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+import org.apache.logging.log4j.core.AbstractLifeCycle;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Node;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.layout.SerializedLayout;
+
+/**
+ * The PulsarAppender logs events to an Apache Pulsar topic.
+ *
+ * <p>Each log event is sent as a Pulsar record.
+ */
+@Plugin(
+ name = "Pulsar",
+ category = Node.CATEGORY,
+ elementType = Appender.ELEMENT_TYPE,
+ printObject = true)
+public final class PulsarAppender extends AbstractAppender {
+
+ /**
+ * Builds PulsarAppender instances.
+ * @param <B> The type to build
+ */
+ public static class Builder<B extends Builder<B>> extends
AbstractAppender.Builder<B>
+ implements
org.apache.logging.log4j.core.util.Builder<PulsarAppender> {
+
+ @PluginAttribute("key")
Review comment:
@jvz sorry that I am not the expert of log4j. but yeah, I was following what
KafkaAppender is doing. Happy to change to the way that is most suitable here
if you can point me a few pointers.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 305953)
Time Spent: 40m (was: 0.5h)
> New appender for Apache Pulsar
> ------------------------------
>
> Key: LOG4J2-2280
> URL: https://issues.apache.org/jira/browse/LOG4J2-2280
> Project: Log4j 2
> Issue Type: New Feature
> Components: Appenders
> Reporter: Sijie Guo
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> It would be useful to have an Appender which sends log events to an[ ApacheĀ
> Pulsar|https://pulsar.incubator.apache.org/] topic.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)