Repair logging
This commit is contained in:
@ -16,3 +16,12 @@ Found multiple occurrences of org.json.JSONObject on the class path:
|
|||||||
|
|
||||||
You may wish to exclude one of them to ensure predictable runtime behavior
|
You may wish to exclude one of them to ensure predictable runtime behavior
|
||||||
"}
|
"}
|
||||||
|
{"timestamp":"2025-05-26T20:04:28.406Z","thread":"[main]","level":"WARN","logger":"o.s.b.t.j.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer","message":"
|
||||||
|
|
||||||
|
Found multiple occurrences of org.json.JSONObject on the class path:
|
||||||
|
|
||||||
|
jar:file:/C:/Users/irigm/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
|
||||||
|
jar:file:/C:/Users/irigm/.m2/repository/org/json/json/20231013/json-20231013.jar!/org/json/JSONObject.class
|
||||||
|
|
||||||
|
You may wish to exclude one of them to ensure predictable runtime behavior
|
||||||
|
"}
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>org.ccalm</groupId>
|
<groupId>org.ccalm</groupId>
|
||||||
<artifactId>translation</artifactId>
|
<artifactId>translation</artifactId>
|
||||||
<version>1.0.3</version>
|
<version>1.0.4</version>
|
||||||
<name>translation</name>
|
<name>translation</name>
|
||||||
<description>Translation project</description>
|
<description>Translation project</description>
|
||||||
<url/>
|
<url/>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MarkerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
@ -104,9 +105,9 @@ public class MainController implements ServletContextAware {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
return new ResponseEntity<>(json.toString(), HttpStatus.OK);
|
return new ResponseEntity<>(json.toString(), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
logger.error(uuid, e);
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
return new ResponseEntity<>(new ErrorResponseModel(500, 10000, trt.trt(false, "Internal_Server_Error"), null, uuid), HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<>(new ErrorResponseModel(500, 10000, trt.trt(false, "Internal_Server_Error"), null, uuid), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +170,6 @@ public class MainController implements ServletContextAware {
|
|||||||
@CookieValue(value = "lng", defaultValue = "1") String language_id
|
@CookieValue(value = "lng", defaultValue = "1") String language_id
|
||||||
) {
|
) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
String error="":
|
|
||||||
try {
|
try {
|
||||||
String sql="""
|
String sql="""
|
||||||
select
|
select
|
||||||
@ -194,7 +194,8 @@ public class MainController implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
} catch( DataAccessException ex )
|
} catch( DataAccessException ex )
|
||||||
{
|
{
|
||||||
logger.info(ex.getMessage());
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//In JavaScript code
|
//In JavaScript code
|
||||||
|
|||||||
@ -2,11 +2,15 @@ package org.ccalm.translation.tools;
|
|||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MarkerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Cache implements AutoCloseable {
|
public class Cache implements AutoCloseable {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(Cache.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Cache.class);
|
||||||
private Jedis jedis = null;
|
private Jedis jedis = null;
|
||||||
|
|
||||||
String host = null;
|
String host = null;
|
||||||
@ -23,9 +27,10 @@ public class Cache implements AutoCloseable {
|
|||||||
try {
|
try {
|
||||||
jedis = new Jedis(host, port);
|
jedis = new Jedis(host, port);
|
||||||
jedis.auth(password);
|
jedis.auth(password);
|
||||||
}catch (Exception e)
|
}catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.error(e);
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,14 +6,17 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import org.ccalm.translation.models.ErrorResponseModel;
|
import org.ccalm.translation.models.ErrorResponseModel;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MarkerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public class CustomException extends Exception {
|
public class CustomException extends Exception {
|
||||||
private static final Logger logger = LogManager.getLogger(CustomException.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CustomException.class);
|
||||||
|
|
||||||
private ErrorResponseModel error;
|
private ErrorResponseModel error;
|
||||||
@Getter
|
@Getter
|
||||||
@ -70,8 +73,9 @@ public class CustomException extends Exception {
|
|||||||
json.put("error_message", this.getErrorMessages());
|
json.put("error_message", this.getErrorMessages());
|
||||||
json.put("error_setting", this.getErrorSettings());
|
json.put("error_setting", this.getErrorSettings());
|
||||||
json.put("error_marker", this.getErrorMarker());
|
json.put("error_marker", this.getErrorMarker());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException ex) {
|
||||||
logger.error("Error", e);
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,16 @@ package org.ccalm.translation.tools;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MarkerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Storage implements AutoCloseable {
|
public class Storage implements AutoCloseable {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(Storage.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Storage.class);
|
||||||
|
|
||||||
private Connection conn = null;
|
private Connection conn = null;
|
||||||
|
|
||||||
public Storage(){
|
public Storage(){
|
||||||
@ -29,8 +33,10 @@ public class Storage implements AutoCloseable {
|
|||||||
""";
|
""";
|
||||||
stmt.execute(sql);
|
stmt.execute(sql);
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("Error connecting or executing SQL query in SQLite", e);
|
//logger.error("Error connecting or executing SQL query in SQLite", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +47,10 @@ public class Storage implements AutoCloseable {
|
|||||||
try {
|
try {
|
||||||
conn.close();
|
conn.close();
|
||||||
conn=null;
|
conn=null;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("SQLite close error", e);
|
//logger.error("SQLite close error", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +85,14 @@ public class Storage implements AutoCloseable {
|
|||||||
result.put("time_r", rs.getLong("time_r"));
|
result.put("time_r", rs.getLong("time_r"));
|
||||||
result.put("time_a", rs.getLong("time_a"));
|
result.put("time_a", rs.getLong("time_a"));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("An error occurred", e);
|
//logger.error("An error occurred", e);
|
||||||
} catch (Exception e) {
|
String uuid = UUID.randomUUID().toString();
|
||||||
logger.error("An error occurred", e);
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
//logger.error("An error occurred", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -118,8 +130,10 @@ public class Storage implements AutoCloseable {
|
|||||||
insertStmt.close();
|
insertStmt.close();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("SQLite query execution error", e);
|
//logger.error("SQLite query execution error", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,8 +147,10 @@ public class Storage implements AutoCloseable {
|
|||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
key = rs.getString("key");
|
key = rs.getString("key");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("SQLite query execution error", e);
|
//logger.error("SQLite query execution error", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@ -148,8 +164,10 @@ public class Storage implements AutoCloseable {
|
|||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
time = rs.getLong("time_r");
|
time = rs.getLong("time_r");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("SQLite query execution error", e);
|
//logger.error("SQLite query execution error", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
@ -160,8 +178,10 @@ public class Storage implements AutoCloseable {
|
|||||||
pstmt.setString(1, email);
|
pstmt.setString(1, email);
|
||||||
pstmt.executeUpdate();
|
pstmt.executeUpdate();
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
logger.error("SQLite query execution error", e);
|
//logger.error("SQLite query execution error", e);
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,11 @@ import io.jsonwebtoken.SignatureAlgorithm;
|
|||||||
import io.jsonwebtoken.security.Keys;
|
import io.jsonwebtoken.security.Keys;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.ccalm.translation.MainController;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MarkerFactory;
|
||||||
|
|
||||||
import javax.crypto.*;
|
import javax.crypto.*;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
@ -14,6 +17,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -23,7 +27,7 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class Tools {
|
public class Tools {
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
private static final Logger logger = LogManager.getLogger(Tools.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Tools.class);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
public static JSONObject createJSONError(int code, String message, String setting, String marker) {
|
public static JSONObject createJSONError(int code, String message, String setting, String marker) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
@ -32,8 +36,9 @@ public class Tools {
|
|||||||
json.put("error_message", Arrays.asList(message));
|
json.put("error_message", Arrays.asList(message));
|
||||||
json.put("error_setting", Arrays.asList(setting));
|
json.put("error_setting", Arrays.asList(setting));
|
||||||
json.put("error_marker", marker);
|
json.put("error_marker", marker);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException ex) {
|
||||||
logger.error(e);
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
logger.error(MarkerFactory.getMarker(uuid), ex.getMessage());
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user