Skip to content

Commit

Permalink
Merge branch 'master' into task/upgrade_docker_debian_image_based_ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
AlvaroVega committed Jan 19, 2023
2 parents 6191a98 + bbc91cb commit 5220326
Show file tree
Hide file tree
Showing 60 changed files with 686 additions and 349 deletions.
14 changes: 8 additions & 6 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[cygnus-ngsi] Update NameMapping compile log mensage from WARN to ERROR
[cygnus-common] MongoDB indexes are created depending on DM (#2204)
[cygnus-common] Upgrade postgresql from 42.4.1 to 42.4.3
[cygnus-common] OracleSQL backend (#2195)
[cygnus-ngsi] OracleSQL ngsi sink added (for OracleS 11g and 12c) (#2195)
[cygnus-ngsi] Removes "_" in schema name for DM -schema family (#2201)
[cygnus-ngsi] Update NameMapping compile log mensage from WARN to ERROR
[cygnus-common] MongoDB indexes are created depending on DM (#2204)
[cygnus-common] Upgrade postgresql from 42.4.1 to 42.4.3
[cygnus-common] OracleSQL backend (#2195)
[cygnus-common][cygnus-twitter] Upgrade flume-ng-node version from 1.9.0 to 1.11.0 (#2179)
[cygnus-common][cygnus-twitter][cygnus-ngsi][cygnus-ngsi-ld] Upgrade log4j from v1 (1.2.17) to v2 (2.17.2) series (#1592)
[cygnus-ngsi] OracleSQL ngsi sink added (for OracleS 11g and 12c) (#2195)
[cygnus-ngsi] Removes "_" in schema name for DM -schema family (#2201)
71 changes: 0 additions & 71 deletions cygnus-common/conf/log4j.properties.template

This file was deleted.

57 changes: 57 additions & 0 deletions cygnus-common/conf/log4j2.properties.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Copyright 2014-2017 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of fiware-cygnus (FIWARE project).
#
# fiware-cygnus is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
# later version.
# fiware-cygnus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along with fiware-cygnus. If not, see
# http://www.gnu.org/licenses/.
#
# For those usages not covered by the GNU Affero General Public License please contact with iot_support at tid dot es
#

# To be put in APACHE_FLUME_HOME/conf/log4j2.properties
# Define some default values.
# These can be overridden by system properties, e.g. the following logs in the standard output, which is very useful
# for testing purposes (-Dflume.root.logger=DEBUG,console)
flume.root.logger=WARN,LOGFILE
#flume.root.logger=DEBUG,console
flume.log.dir=/var/log/cygnus/
flume.log.file=cygnus.log

# Logging level for third party components.
log4j.logger.org.apache.flume.lifecycle = WARN
log4j.logger.org.jboss = WARN
log4j.logger.org.mortbay = WARN
log4j.logger.org.apache.avro.ipc.NettyTransceiver = WARN
log4j.logger.org.apache.hadoop = WARN
log4j.logger.org.mongodb = WARN
log4j.logger.org.apache.http = WARN
log4j.logger.org.apache.zookeeper = WARN
log4j.logger.org.apache.kafka = WARN
log4j.logger.org.I0Itec = WARN
log4j.logger.com.amazonaws = WARN
log4j.logger.org.eclipse.jetty = WARN

# Extra logging related to initialization of Log4j
# Set to debug or trace if log4j initialization is failing
status = warn
# Name of the configuration
name = ConsoleLogConfig

# Console appender configuration
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = time=%d{yyyy-MM-dd}T%d{HH:mm:ss.SSS}Z | lvl=%p | corr=%X{correlatorId} | trans=%X{transactionId} | srv=%X{service} | subsrv=%X{subservice} | comp=%X{agent} | op=%M | msg=%C[%L] : %m%n

# Root logger level
rootLogger.level = warn
# Root logger referring to console appender
rootLogger.appenderRef.stdout.ref = consoleLogger
25 changes: 21 additions & 4 deletions cygnus-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>mvnrepository</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>

<dependencies>
<!-- Required for testing -->
<dependency>
Expand All @@ -33,7 +40,7 @@
<dependency>
<groupId>org.apache.flume</groupId>
<artifactId>flume-ng-node</artifactId>
<version>1.9.0</version>
<version>1.11.0</version>
</dependency>
<!-- Required in order to overwrite the versions bundled in Apache Flume -->
<dependency>
Expand Down Expand Up @@ -87,9 +94,19 @@
</dependency>
<!-- Required for logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.2</version>
</dependency>
<!-- Required by HDFSBackendImplBinary -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import java.util.Map.Entry;
import java.util.Set;

import org.apache.log4j.Logger;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package com.telefonica.iot.cygnus.backends.arcgis.model;

import org.apache.log4j.Logger;

import com.google.gson.JsonObject;
import com.telefonica.iot.cygnus.backends.arcgis.exceptions.ArcgisException;
import com.telefonica.iot.cygnus.log.CygnusLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.StringEntity;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
Expand Down Expand Up @@ -258,7 +259,7 @@ private class PrivilegedRequest implements PrivilegedAction<Object> {
* @param entity
*/
PrivilegedRequest(String method, String url, ArrayList<Header> headers, StringEntity entity) {
this.logger = Logger.getLogger(PrivilegedRequest.class);
this.logger = LogManager.getLogger(PrivilegedRequest.class);
this.method = method;
this.url = url;
this.headers = headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package com.telefonica.iot.cygnus.log;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.spi.ExtendedLogger;

/**
* Wrapper class for log4j Logger class. Reference:
Expand All @@ -30,14 +32,22 @@
public class CygnusLogger {

private static String fqcn = CygnusLogger.class.getName();
private Logger logger;
private final ExtendedLogger logger;

/**
* Constructor.
* @param logger
*/
private CygnusLogger(final Logger logger) {
this.logger = (ExtendedLogger) logger;
}

/**
* Constructor.
* @param name
*/
public CygnusLogger(String name) {
this.logger = Logger.getLogger(name);
this(LogManager.getLogger(name));
} // CygnusLogger

/**
Expand All @@ -54,7 +64,7 @@ public CygnusLogger(Class clazz) {
*/
public void fatal(Object msg) {
try {
logger.log(fqcn, Level.FATAL, msg, null);
this.logger.logIfEnabled(fqcn, Level.FATAL, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand All @@ -66,7 +76,7 @@ public void fatal(Object msg) {
*/
public void error(Object msg) {
try {
logger.log(fqcn, Level.ERROR, msg, null);
this.logger.logIfEnabled(fqcn, Level.ERROR, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand All @@ -78,7 +88,7 @@ public void error(Object msg) {
*/
public void debug(Object msg) {
try {
logger.log(fqcn, Level.DEBUG, msg, null);
this.logger.logIfEnabled(fqcn, Level.DEBUG, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand All @@ -90,7 +100,7 @@ public void debug(Object msg) {
*/
public void info(Object msg) {
try {
logger.log(fqcn, Level.INFO, msg, null);
this.logger.logIfEnabled(fqcn, Level.INFO, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand All @@ -102,7 +112,7 @@ public void info(Object msg) {
*/
public void warn(Object msg) {
try {
logger.log(fqcn, Level.WARN, msg, null);
this.logger.logIfEnabled(fqcn, Level.WARN, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand All @@ -115,7 +125,7 @@ public void warn(Object msg) {
*/
public void trace(Object msg) {
try {
logger.log(fqcn, Level.TRACE, msg, null);
this.logger.logIfEnabled(fqcn, Level.TRACE, null, msg.toString());
} catch (Exception e) {
traceAndExit(e);
} // try catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package com.telefonica.iot.cygnus.management;

import com.google.common.collect.ImmutableMap;
import java.util.Map;
import com.telefonica.iot.cygnus.channels.CygnusChannel;
import java.io.BufferedReader;
import java.io.FileReader;
Expand Down Expand Up @@ -69,7 +69,7 @@ public static void getRoot(HttpServletResponse response) throws IOException {
* @param channels
* @throws IOException
*/
public static void getPoints(HttpServletResponse response, ImmutableMap<String, Channel> channels)
public static void getPoints(HttpServletResponse response, Map<String, Channel> channels)
throws IOException {
// add a new source row
String sourceColumns = "";
Expand Down
Loading

0 comments on commit 5220326

Please sign in to comment.