From 89c414fa4bd6ea09898623940ee8afbda22bfa6d Mon Sep 17 00:00:00 2001 From: Philipp Zehnder Date: Sat, 28 Oct 2023 12:35:42 +0200 Subject: [PATCH] refactor(#2088): Remove module streampipes-logging (#2089) * refactor(#2088): Remove module streampipes-logging * refactor(#2088): Remove obsolete import of removed logging package --- pom.xml | 1 - .../streampipes-connectors-influx/pom.xml | 6 ++ .../connectors/influx/sink/InfluxDbSink.java | 9 +-- .../urldereferencing/UrlDereferencing.java | 3 - .../inverter/BooleanInverterProcessor.java | 3 - .../counter/StringCounterProcessor.java | 4 -- .../state/StringToStateProcessor.java | 4 -- .../timer/StringTimerProcessor.java | 4 -- .../databases/jvm/jdbcclient/JdbcClient.java | 30 ++++---- .../databases/jvm/postgresql/PostgreSql.java | 16 ++--- streampipes-logging/pom.xml | 46 ------------- .../streampipes/logging/LoggerFactory.java | 31 --------- .../streampipes/logging/api/Logger.java | 34 --------- .../logging/impl/EventStatisticLogger.java | 41 ----------- .../streampipes/logging/impl/PeLogger.java | 62 ----------------- .../apache/streampipes/logging/model/Log.java | 69 ------------------- .../streampipes/logging/model/LogRequest.java | 50 -------------- streampipes-model/pom.xml | 5 -- .../base/InvocableStreamPipesEntity.java | 7 -- streampipes-service-discovery-consul/pom.xml | 5 -- .../wrapper/flink/logger/StatisticLogger.java | 2 - .../kafka/converter/JsonToMapFormat.java | 2 - 22 files changed, 33 insertions(+), 401 deletions(-) delete mode 100644 streampipes-logging/pom.xml delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/LoggerFactory.java delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/api/Logger.java delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/EventStatisticLogger.java delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/PeLogger.java delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/model/Log.java delete mode 100644 streampipes-logging/src/main/java/org/apache/streampipes/logging/model/LogRequest.java diff --git a/pom.xml b/pom.xml index f9f4efa624..2f4eed87af 100644 --- a/pom.xml +++ b/pom.xml @@ -1339,7 +1339,6 @@ streampipes-dataformat-smile streampipes-extensions streampipes-integration-tests - streampipes-logging streampipes-mail streampipes-maven-plugin streampipes-measurement-units diff --git a/streampipes-extensions/streampipes-connectors-influx/pom.xml b/streampipes-extensions/streampipes-connectors-influx/pom.xml index 01caf7b574..eff4895e51 100644 --- a/streampipes-extensions/streampipes-connectors-influx/pom.xml +++ b/streampipes-extensions/streampipes-connectors-influx/pom.xml @@ -44,10 +44,16 @@ streampipes-wrapper-standalone 0.93.0-SNAPSHOT + + org.influxdb influxdb-java + + org.slf4j + slf4j-api + diff --git a/streampipes-extensions/streampipes-connectors-influx/src/main/java/org/apache/streampipes/extensions/connectors/influx/sink/InfluxDbSink.java b/streampipes-extensions/streampipes-connectors-influx/src/main/java/org/apache/streampipes/extensions/connectors/influx/sink/InfluxDbSink.java index 78946c8103..6e169a364f 100644 --- a/streampipes-extensions/streampipes-connectors-influx/src/main/java/org/apache/streampipes/extensions/connectors/influx/sink/InfluxDbSink.java +++ b/streampipes-extensions/streampipes-connectors-influx/src/main/java/org/apache/streampipes/extensions/connectors/influx/sink/InfluxDbSink.java @@ -21,7 +21,6 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.extensions.api.pe.context.EventSinkRuntimeContext; import org.apache.streampipes.extensions.connectors.influx.shared.InfluxConfigs; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.DataSinkType; import org.apache.streampipes.model.graph.DataSinkDescription; import org.apache.streampipes.model.runtime.Event; @@ -35,6 +34,9 @@ import org.apache.streampipes.wrapper.params.compat.SinkParams; import org.apache.streampipes.wrapper.standalone.StreamPipesDataSink; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import static org.apache.streampipes.extensions.connectors.influx.shared.InfluxKeys.BATCH_INTERVAL_ACTIONS_KEY; import static org.apache.streampipes.extensions.connectors.influx.shared.InfluxKeys.DATABASE_MEASUREMENT_KEY; import static org.apache.streampipes.extensions.connectors.influx.shared.InfluxKeys.MAX_FLUSH_DURATION_KEY; @@ -42,17 +44,16 @@ public class InfluxDbSink extends StreamPipesDataSink { + private static final Logger LOG = LoggerFactory.getLogger(InfluxDbSink.class); private InfluxDbClient influxDbClient; - private static Logger log; @Override public void onInvocation(SinkParams parameters, EventSinkRuntimeContext runtimeContext) throws SpRuntimeException { var extractor = parameters.extractor(); - log = parameters.getModel().getLogger(InfluxDbSink.class); var connectionSettings = InfluxConfigs.fromExtractor(extractor); String measureName = extractor.singleValueParameter(DATABASE_MEASUREMENT_KEY, String.class); @@ -76,7 +77,7 @@ public void onEvent(Event event) { try { influxDbClient.save(event); } catch (SpRuntimeException e) { - log.error(e.getMessage()); + LOG.error(e.getMessage()); } } diff --git a/streampipes-extensions/streampipes-pipeline-elements-experimental-flink/src/main/java/org/apache/streampipes/pe/flink/processor/urldereferencing/UrlDereferencing.java b/streampipes-extensions/streampipes-pipeline-elements-experimental-flink/src/main/java/org/apache/streampipes/pe/flink/processor/urldereferencing/UrlDereferencing.java index c21974b809..b986cac6ba 100644 --- a/streampipes-extensions/streampipes-pipeline-elements-experimental-flink/src/main/java/org/apache/streampipes/pe/flink/processor/urldereferencing/UrlDereferencing.java +++ b/streampipes-extensions/streampipes-pipeline-elements-experimental-flink/src/main/java/org/apache/streampipes/pe/flink/processor/urldereferencing/UrlDereferencing.java @@ -18,7 +18,6 @@ package org.apache.streampipes.pe.flink.processor.urldereferencing; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.graph.DataProcessorInvocation; import org.apache.streampipes.model.runtime.Event; @@ -31,12 +30,10 @@ public class UrlDereferencing implements FlatMapFunction { private String urlString; private String appendHtml; - private Logger logger; public UrlDereferencing(String urlString, String appendHtml, DataProcessorInvocation graph) { this.urlString = urlString; this.appendHtml = appendHtml; - this.logger = graph.getLogger(UrlDereferencing.class); } @Override diff --git a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/inverter/BooleanInverterProcessor.java b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/inverter/BooleanInverterProcessor.java index 17f938f5aa..56186a508a 100644 --- a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/inverter/BooleanInverterProcessor.java +++ b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/inverter/BooleanInverterProcessor.java @@ -21,7 +21,6 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.extensions.api.pe.context.EventProcessorRuntimeContext; import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.DataProcessorType; import org.apache.streampipes.model.graph.DataProcessorDescription; import org.apache.streampipes.model.runtime.Event; @@ -39,7 +38,6 @@ public class BooleanInverterProcessor extends StreamPipesDataProcessor { public static final String INVERT_FIELD_ID = "invert-field"; - private static Logger log; private String invertFieldName; @Override public DataProcessorDescription declareModel() { @@ -62,7 +60,6 @@ public void onInvocation(ProcessorParams parameters, SpOutputCollector spOutputCollector, EventProcessorRuntimeContext runtimeContext) throws SpRuntimeException { ProcessingElementParameterExtractor extractor = parameters.extractor(); - log = parameters.getGraph().getLogger(BooleanInverterProcessor.class); this.invertFieldName = extractor.mappingPropertyValue(INVERT_FIELD_ID); } diff --git a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/counter/StringCounterProcessor.java b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/counter/StringCounterProcessor.java index 27e7220b57..8c48788270 100644 --- a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/counter/StringCounterProcessor.java +++ b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/counter/StringCounterProcessor.java @@ -21,7 +21,6 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.extensions.api.pe.context.EventProcessorRuntimeContext; import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.DataProcessorType; import org.apache.streampipes.model.graph.DataProcessorDescription; import org.apache.streampipes.model.runtime.Event; @@ -42,8 +41,6 @@ public class StringCounterProcessor extends StreamPipesDataProcessor { - private static Logger log; - protected static final String FIELD_ID = "field"; private static final String COUNT_FIELD_ID = "countField"; private static final String CHANGE_FROM_FIELD_ID = "changeFromField"; @@ -85,7 +82,6 @@ public DataProcessorDescription declareModel() { public void onInvocation(ProcessorParams parameters, SpOutputCollector spOutputCollector, EventProcessorRuntimeContext runtimeContext) throws SpRuntimeException { - log = parameters.getGraph().getLogger(StringCounterProcessor.class); ProcessingElementParameterExtractor extractor = parameters.extractor(); this.selectedFieldName = extractor.mappingPropertyValue(FIELD_ID); this.fieldValueOfLastEvent = ""; diff --git a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/state/StringToStateProcessor.java b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/state/StringToStateProcessor.java index 3dfd95dea2..d9804c0a36 100644 --- a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/state/StringToStateProcessor.java +++ b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/state/StringToStateProcessor.java @@ -21,7 +21,6 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.extensions.api.pe.context.EventProcessorRuntimeContext; import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.DataProcessorType; import org.apache.streampipes.model.graph.DataProcessorDescription; import org.apache.streampipes.model.runtime.Event; @@ -45,8 +44,6 @@ public class StringToStateProcessor extends StreamPipesDataProcessor { - private static Logger log; - public static final String STRING_STATE_FIELD = "string_state_field"; public static final String CURRENT_STATE = "current_state"; @@ -74,7 +71,6 @@ public DataProcessorDescription declareModel() { public void onInvocation(ProcessorParams parameters, SpOutputCollector spOutputCollector, EventProcessorRuntimeContext runtimeContext) throws SpRuntimeException { - log = parameters.getGraph().getLogger(StringToStateProcessor.class); ProcessingElementParameterExtractor extractor = parameters.extractor(); this.stateFields = extractor.mappingPropertyValues(STRING_STATE_FIELD); } diff --git a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/timer/StringTimerProcessor.java b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/timer/StringTimerProcessor.java index 65de862a00..c65963c7a6 100644 --- a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/timer/StringTimerProcessor.java +++ b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/stringoperator/timer/StringTimerProcessor.java @@ -21,7 +21,6 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.extensions.api.pe.context.EventProcessorRuntimeContext; import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.DataProcessorType; import org.apache.streampipes.model.graph.DataProcessorDescription; import org.apache.streampipes.model.runtime.Event; @@ -43,8 +42,6 @@ public class StringTimerProcessor extends StreamPipesDataProcessor { - private static Logger log; - public static final String FIELD_ID = "field"; public static final String MEASURED_TIME_ID = "measuredTime"; public static final String FIELD_VALUE_ID = "fieldValue"; @@ -98,7 +95,6 @@ public DataProcessorDescription declareModel() { public void onInvocation(ProcessorParams parameters, SpOutputCollector spOutputCollector, EventProcessorRuntimeContext runtimeContext) throws SpRuntimeException { - log = parameters.getGraph().getLogger(StringTimerProcessor.class); ProcessingElementParameterExtractor extractor = parameters.extractor(); this.selectedFieldName = extractor.mappingPropertyValue(FIELD_ID); diff --git a/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/jdbcclient/JdbcClient.java b/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/jdbcclient/JdbcClient.java index 41ff196001..b62f020c72 100644 --- a/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/jdbcclient/JdbcClient.java +++ b/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/jdbcclient/JdbcClient.java @@ -19,7 +19,6 @@ package org.apache.streampipes.sinks.databases.jvm.jdbcclient; import org.apache.streampipes.commons.exceptions.SpRuntimeException; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.runtime.Event; import org.apache.streampipes.model.schema.EventSchema; import org.apache.streampipes.sinks.databases.jvm.jdbcclient.model.DbDescription; @@ -29,6 +28,9 @@ import org.apache.streampipes.sinks.databases.jvm.jdbcclient.model.TableDescription; import org.apache.streampipes.sinks.databases.jvm.jdbcclient.utils.SQLStatementUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; @@ -38,6 +40,8 @@ public class JdbcClient { + private static final Logger LOG = LoggerFactory.getLogger(JdbcClient.class); + protected DbDescription dbDescription; protected TableDescription tableDescription; @@ -46,8 +50,6 @@ public class JdbcClient { protected StatementHandler statementHandler; - protected Logger logger; - /** * A wrapper class for all supported SQL data types (INT, BIGINT, FLOAT, DOUBLE, VARCHAR(255)). * If no matching type is found, it is interpreted as a String (VARCHAR(255)) @@ -57,12 +59,10 @@ public JdbcClient() { protected void initializeJdbc(EventSchema eventSchema, JdbcConnectionParameters connectionParameters, - SupportedDbEngines dbEngine, - Logger logger) throws SpRuntimeException { + SupportedDbEngines dbEngine) throws SpRuntimeException { this.dbDescription = new DbDescription(connectionParameters, dbEngine); this.tableDescription = new TableDescription(connectionParameters.getDbTable(), eventSchema); this.statementHandler = new StatementHandler(null, null); - this.logger = logger; try { Class.forName(this.dbDescription.getDriverName()); } catch (ClassNotFoundException e) { @@ -115,9 +115,9 @@ private void connect(String host, int port, String databaseName) throws SpRuntim private void connectWithSSL(String host, int port, String databaseName) throws SpRuntimeException { String url = "jdbc:" + this.dbDescription.getEngine().getUrlName() + "://" + host + ":" + port + "/" + databaseName - + "?user=" - + this.dbDescription.getUsername() + "&password=" + this.dbDescription.getPassword() - + "&ssl=true&sslfactory=" + this.dbDescription.getSslFactory() + "&sslmode=require"; + + "?user=" + + this.dbDescription.getUsername() + "&password=" + this.dbDescription.getPassword() + + "&ssl=true&sslfactory=" + this.dbDescription.getSslFactory() + "&sslmode=require"; try { connection = DriverManager.getConnection(url); ensureDatabaseExists(databaseName); @@ -149,7 +149,7 @@ protected void ensureDatabaseExists(String createStatement, String databaseName) // Checks whether the database already exists (using catalogs has not worked with postgres) this.statementHandler.setStatement(connection.createStatement()); this.statementHandler.statement.executeUpdate(createStatement + databaseName + ";"); - logger.info("Created new database '" + databaseName + "'"); + LOG.info("Created new database '" + databaseName + "'"); } catch (SQLException e1) { if (!e1.getSQLState().substring(0, 2).equals("42")) { throw new SpRuntimeException("Error while creating database: " + e1.getMessage()); @@ -214,7 +214,7 @@ protected void save(final Event event) throws SpRuntimeException { if (e.getSQLState().substring(0, 2).equals("42")) { // If the table does not exists (because it got deleted or something, will cause the error // code "42") we will try to create a new one. Otherwise we do not handle the exception. - logger.warn("Table '" + this.tableDescription.getName() + "' was unexpectedly not found and gets recreated."); + LOG.warn("Table '" + this.tableDescription.getName() + "' was unexpectedly not found and gets recreated."); this.tableDescription.setTableMissing(); createTable(); this.tableDescription.setTableExists(); @@ -266,7 +266,7 @@ protected void closeAll() { } } catch (SQLException e) { error = true; - logger.warn("Exception when closing the statement: " + e.getMessage()); + LOG.warn("Exception when closing the statement: " + e.getMessage()); } try { if (connection != null) { @@ -275,7 +275,7 @@ protected void closeAll() { } } catch (SQLException e) { error = true; - logger.warn("Exception when closing the connection: " + e.getMessage()); + LOG.warn("Exception when closing the connection: " + e.getMessage()); } try { if (this.statementHandler.preparedStatement != null) { @@ -284,10 +284,10 @@ protected void closeAll() { } } catch (SQLException e) { error = true; - logger.warn("Exception when closing the prepared statement: " + e.getMessage()); + LOG.warn("Exception when closing the prepared statement: " + e.getMessage()); } if (!error) { - logger.info("Shutdown all connections successfully."); + LOG.info("Shutdown all connections successfully."); } } diff --git a/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/postgresql/PostgreSql.java b/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/postgresql/PostgreSql.java index 268342d6d0..dc4c1d4c75 100644 --- a/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/postgresql/PostgreSql.java +++ b/streampipes-extensions/streampipes-sinks-databases-jvm/src/main/java/org/apache/streampipes/sinks/databases/jvm/postgresql/PostgreSql.java @@ -19,22 +19,23 @@ package org.apache.streampipes.sinks.databases.jvm.postgresql; import org.apache.streampipes.commons.exceptions.SpRuntimeException; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.runtime.Event; import org.apache.streampipes.sinks.databases.jvm.jdbcclient.JdbcClient; import org.apache.streampipes.sinks.databases.jvm.jdbcclient.model.SupportedDbEngines; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class PostgreSql extends JdbcClient { - private PostgreSqlParameters params; + private static final Logger LOG = LoggerFactory.getLogger(PostgreSql.class); - private Logger log; + private PostgreSqlParameters params; public void onInvocation(PostgreSqlParameters parameters) throws SpRuntimeException { this.params = parameters; - this.log = parameters.getGraph().getLogger(PostgreSql.class); // get(0) because it is the only input stream of the sink (and not two) // See (https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS) @@ -42,8 +43,7 @@ public void onInvocation(PostgreSqlParameters parameters) initializeJdbc( parameters.getGraph().getInputStreams().get(0).getEventSchema(), parameters, - SupportedDbEngines.POSTGRESQL, - this.log); + SupportedDbEngines.POSTGRESQL); } @Override @@ -61,9 +61,7 @@ public void onEvent(Event event) { try { save(event); } catch (SpRuntimeException e) { - //TODO: error or warn? - log.error(e.getMessage()); - //e.printStackTrace(); + LOG.error(e.getMessage()); } } diff --git a/streampipes-logging/pom.xml b/streampipes-logging/pom.xml deleted file mode 100644 index ace84d9415..0000000000 --- a/streampipes-logging/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - streampipes-parent - org.apache.streampipes - 0.93.0-SNAPSHOT - - 4.0.0 - - StreamPipes Logging - streampipes-logging - - - - - org.slf4j - slf4j-api - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - \ No newline at end of file diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/LoggerFactory.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/LoggerFactory.java deleted file mode 100644 index 883ac39aa7..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/LoggerFactory.java +++ /dev/null @@ -1,31 +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.streampipes.logging; - -import org.apache.streampipes.logging.api.Logger; -import org.apache.streampipes.logging.impl.PeLogger; - -public class LoggerFactory { - - // public static Logger getPeLogger(Class clazz, String correspondingPipeline, String peUri, PeConfig peConfig) { - public static Logger getPeLogger(Class clazz, String correspondingPipeline, String peUri) { - // return new PeLogger(clazz, correspondingPipeline, peUri, peConfig); - return new PeLogger(clazz, correspondingPipeline, peUri); - } -} diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/api/Logger.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/api/Logger.java deleted file mode 100644 index c1ee5288bc..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/api/Logger.java +++ /dev/null @@ -1,34 +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.streampipes.logging.api; - -import java.io.Serializable; - -public interface Logger extends Serializable { - - void info(String s); - - void trace(String s); - - void debug(String s); - - void error(String s); - - void warn(String s); -} diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/EventStatisticLogger.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/EventStatisticLogger.java deleted file mode 100644 index 559ce892a3..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/EventStatisticLogger.java +++ /dev/null @@ -1,41 +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.streampipes.logging.impl; - -import java.io.Serializable; - -public class EventStatisticLogger implements Serializable { - - - // private String prefix; - - // public static void log(org.apache.streampipes.model.base.InvocableStreamPipesEntity graph) { - public static void log(String name, String correspondingPipeline, String source) { - // TODO: Uncomment when "Event statistic" should be used - /* String prefix = "SYSTEMLOG EVENT STATISTIC" + " - " - // + "serviceName: " + peConfig.getName() + " - " - + "correspondingPipeline: " + correspondingPipeline + " - " - + "peURI: " + source + " - "; - - org.slf4j.Logger logger = LoggerFactory.getLogger(EventStatisticLogger.class); - logger.info(prefix + 1); - */ - } - -} diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/PeLogger.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/PeLogger.java deleted file mode 100644 index 392cc8edd7..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/impl/PeLogger.java +++ /dev/null @@ -1,62 +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.streampipes.logging.impl; - -import org.apache.streampipes.logging.api.Logger; - -import org.slf4j.LoggerFactory; - -public class PeLogger implements Logger { - - private org.slf4j.Logger logger; - - private String prefix; - - - //public PeLogger(Class clazz, String correspondingPipeline, String peUri, PeConfig peConfig){ - public PeLogger(Class clazz, String correspondingPipeline, String peUri) { - this.prefix = "USERLOG" + " - " - // + "serviceName: " + peConfig.getName() + " - " - + "correspondingPipeline: " + correspondingPipeline + " - " - + "peURI: " + peUri + " - "; - - logger = LoggerFactory.getLogger(clazz); - } - - public void info(String s) { - logger.info(prefix + s); - } - - public void trace(String s) { - logger.trace(prefix + s); - } - - public void debug(String s) { - logger.debug(prefix + s); - } - - public void error(String s) { - logger.error(prefix + s); - } - - public void warn(String s) { - logger.warn(prefix + s); - } - -} diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/Log.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/Log.java deleted file mode 100644 index d6d962d5b9..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/Log.java +++ /dev/null @@ -1,69 +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.streampipes.logging.model; - -public class Log { - - private String sourceID; - private String timestamp; - private String level; - private String type; - private String message; - - - public String getsourceID() { - return sourceID; - } - - public void setsourceID(String sourceID) { - this.sourceID = sourceID; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getLevel() { - return level; - } - - public void setLevel(String level) { - this.level = level; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/LogRequest.java b/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/LogRequest.java deleted file mode 100644 index 66fd5803e9..0000000000 --- a/streampipes-logging/src/main/java/org/apache/streampipes/logging/model/LogRequest.java +++ /dev/null @@ -1,50 +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.streampipes.logging.model; - -public class LogRequest { - - private String sourceID; - private String dateFrom; - private String dateTo; - - public String getSourceID() { - return sourceID; - } - - public void setSourceID(String source) { - this.sourceID = source; - } - - public String getDateFrom() { - return dateFrom; - } - - public void setDateFrom(String dateFrom) { - this.dateFrom = dateFrom; - } - - public String getDateTo() { - return dateTo; - } - - public void setDateTo(String dateTo) { - this.dateTo = dateTo; - } -} diff --git a/streampipes-model/pom.xml b/streampipes-model/pom.xml index 1dec14801d..c4d593d7e3 100644 --- a/streampipes-model/pom.xml +++ b/streampipes-model/pom.xml @@ -37,11 +37,6 @@ streampipes-model-shared 0.93.0-SNAPSHOT - - org.apache.streampipes - streampipes-logging - 0.93.0-SNAPSHOT - org.apache.streampipes streampipes-vocabulary diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/base/InvocableStreamPipesEntity.java b/streampipes-model/src/main/java/org/apache/streampipes/model/base/InvocableStreamPipesEntity.java index 0d64297fc9..b43c37d4af 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/base/InvocableStreamPipesEntity.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/base/InvocableStreamPipesEntity.java @@ -19,8 +19,6 @@ package org.apache.streampipes.model.base; import org.apache.streampipes.commons.constants.InstanceIdExtractor; -import org.apache.streampipes.logging.LoggerFactory; -import org.apache.streampipes.logging.api.Logger; import org.apache.streampipes.model.SpDataStream; import org.apache.streampipes.model.api.EndpointSelectable; import org.apache.streampipes.model.grounding.EventGrounding; @@ -188,9 +186,4 @@ public String getDetachPath() { return "/" + InstanceIdExtractor.extractId(getElementId()); } - //public Logger getLogger(Class clazz, PeConfig peConfig) { - public Logger getLogger(Class clazz) { - //return LoggerFactory.getPeLogger(clazz, getCorrespondingPipeline(), getUri(), peConfig); - return LoggerFactory.getPeLogger(clazz, getCorrespondingPipeline(), getUri()); - } } diff --git a/streampipes-service-discovery-consul/pom.xml b/streampipes-service-discovery-consul/pom.xml index f6e34c39c6..1558218ec1 100644 --- a/streampipes-service-discovery-consul/pom.xml +++ b/streampipes-service-discovery-consul/pom.xml @@ -28,11 +28,6 @@ streampipes-service-discovery-consul - - org.apache.streampipes - streampipes-logging - 0.93.0-SNAPSHOT - org.apache.streampipes streampipes-serializers-json diff --git a/streampipes-wrapper-flink/src/main/java/org/apache/streampipes/wrapper/flink/logger/StatisticLogger.java b/streampipes-wrapper-flink/src/main/java/org/apache/streampipes/wrapper/flink/logger/StatisticLogger.java index 1fc4f1707c..73374c773b 100644 --- a/streampipes-wrapper-flink/src/main/java/org/apache/streampipes/wrapper/flink/logger/StatisticLogger.java +++ b/streampipes-wrapper-flink/src/main/java/org/apache/streampipes/wrapper/flink/logger/StatisticLogger.java @@ -18,7 +18,6 @@ package org.apache.streampipes.wrapper.flink.logger; -import org.apache.streampipes.logging.impl.EventStatisticLogger; import org.apache.streampipes.model.base.InvocableStreamPipesEntity; import org.apache.streampipes.model.runtime.Event; @@ -35,7 +34,6 @@ public StatisticLogger(InvocableStreamPipesEntity graph) { @Override public void flatMap(Event in, Collector out) throws Exception { - EventStatisticLogger.log(graph.getName(), graph.getCorrespondingPipeline(), graph.getUri()); out.collect(in); } } diff --git a/streampipes-wrapper-kafka-streams/src/main/java/org/apache/streampipes/wrapper/kafka/converter/JsonToMapFormat.java b/streampipes-wrapper-kafka-streams/src/main/java/org/apache/streampipes/wrapper/kafka/converter/JsonToMapFormat.java index 9a077d313e..390dc65e40 100644 --- a/streampipes-wrapper-kafka-streams/src/main/java/org/apache/streampipes/wrapper/kafka/converter/JsonToMapFormat.java +++ b/streampipes-wrapper-kafka-streams/src/main/java/org/apache/streampipes/wrapper/kafka/converter/JsonToMapFormat.java @@ -17,7 +17,6 @@ */ package org.apache.streampipes.wrapper.kafka.converter; -import org.apache.streampipes.logging.impl.EventStatisticLogger; import org.apache.streampipes.model.base.InvocableStreamPipesEntity; import com.fasterxml.jackson.databind.ObjectMapper; @@ -43,7 +42,6 @@ public JsonToMapFormat(InvocableStreamPipesEntity graph) { @Override public Iterable> apply(String s) { try { - EventStatisticLogger.log(graph.getName(), graph.getCorrespondingPipeline(), graph.getUri()); return Arrays.asList(mapper.readValue(s, HashMap.class)); } catch (IOException e) { e.printStackTrace();