diff --git a/java/edu/ucar/metviewer/MVBatch.java b/java/edu/ucar/metviewer/MVBatch.java index 42084bcd..aba5c98e 100644 --- a/java/edu/ucar/metviewer/MVBatch.java +++ b/java/edu/ucar/metviewer/MVBatch.java @@ -13,8 +13,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - - public class MVBatch { private static final Logger logger = LogManager.getLogger(MVBatch.class); @@ -450,7 +448,6 @@ public static void main(String[] argv) throws Exception { logger.info("---- MVBatch Done by user " + username + " ----"); logger.info("Total execution time " + stopWatch.getFormattedTotalDuration()); - + } - } diff --git a/java/edu/ucar/metviewer/MVLoad.java b/java/edu/ucar/metviewer/MVLoad.java index a7df9827..5110ec93 100644 --- a/java/edu/ucar/metviewer/MVLoad.java +++ b/java/edu/ucar/metviewer/MVLoad.java @@ -11,6 +11,7 @@ import org.apache.logging.log4j.*; import org.apache.logging.log4j.io.IoBuilder; + public class MVLoad { private static final Logger logger = LogManager.getLogger("MVLoad"); @@ -69,7 +70,6 @@ private MVLoad() { public static void main(String[] argv) { logger.info("---- MVLoad ----\n"); - try { // parse the input arguments diff --git a/java/edu/ucar/metviewer/MVServlet.java b/java/edu/ucar/metviewer/MVServlet.java index 67dc3ac2..3324087c 100644 --- a/java/edu/ucar/metviewer/MVServlet.java +++ b/java/edu/ucar/metviewer/MVServlet.java @@ -876,6 +876,7 @@ private String getAvailableResults(String showAll) throws ParserConfigurationExc @Override public void init() { logger.debug("init() - loading properties..."); + try { ResourceBundle bundle = ResourceBundle.getBundle("mvservlet"); diff --git a/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java b/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java index 48a0bdc9..5573226b 100644 --- a/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java +++ b/java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java @@ -13,7 +13,6 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; - import java.io.*; import java.sql.*; import java.text.SimpleDateFormat; diff --git a/java/edu/ucar/metviewer/db/mysql/MysqlDatabaseManager.java b/java/edu/ucar/metviewer/db/mysql/MysqlDatabaseManager.java index 8bc90adf..ee37912c 100644 --- a/java/edu/ucar/metviewer/db/mysql/MysqlDatabaseManager.java +++ b/java/edu/ucar/metviewer/db/mysql/MysqlDatabaseManager.java @@ -28,7 +28,6 @@ import edu.ucar.metviewer.db.DatabaseManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - import org.apache.tomcat.jdbc.pool.DataSource; import org.apache.tomcat.jdbc.pool.PoolConfiguration; import org.apache.tomcat.jdbc.pool.PoolProperties; @@ -40,7 +39,6 @@ public class MysqlDatabaseManager extends DatabaseManager { private static final Logger logger = LogManager.getLogger(MysqlDatabaseManager.class); - protected static Map listDB = new TreeMap<>(); protected static Map> groupToDatabases = new HashMap<>(); private static String DATE_FORMAT_STRING = "yyyy-MM-dd HH:mm:ss"; @@ -57,6 +55,8 @@ public class MysqlDatabaseManager extends DatabaseManager { public MysqlDatabaseManager(DatabaseInfo databaseInfo, String password) { super(databaseInfo); + // Add hostname to the ThreadContext for logging + String jdbcUrl = getJdbcUrl(databaseInfo.getHost(), databaseInfo.getDbName()); PoolConfiguration configurationToUse = new PoolProperties(); configurationToUse.setUrl(jdbcUrl); @@ -85,15 +85,14 @@ public MysqlDatabaseManager(DatabaseInfo databaseInfo, String password) { dataSource = new DataSource(); dataSource.setPoolProperties(configurationToUse); - - + boolean updateGroups = false; if (databaseInfo.getDbName() == null) { updateGroups = true; } initDBList(updateGroups); } - + public synchronized String formatDate(Date date) { return DATE_FORMAT.format(date.getTime()); } diff --git a/java/edu/ucar/metviewer/db/mysql/MysqlLoadDatabaseManager.java b/java/edu/ucar/metviewer/db/mysql/MysqlLoadDatabaseManager.java index e6fbcbd1..3c62b708 100644 --- a/java/edu/ucar/metviewer/db/mysql/MysqlLoadDatabaseManager.java +++ b/java/edu/ucar/metviewer/db/mysql/MysqlLoadDatabaseManager.java @@ -13,7 +13,6 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; - import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -82,7 +81,6 @@ public class MysqlLoadDatabaseManager extends MysqlDatabaseManager implements Lo public MysqlLoadDatabaseManager( DatabaseInfo databaseInfo, String password) throws DatabaseException { super(databaseInfo, password); - tableToInsert = new HashMap<>(); tableToInsert.put("line_data_fho", "INSERT INTO line_data_fho VALUES (?,?,?,?,?,?,?,?,?,?,?,?," + "?,?)");//14 diff --git a/java/edu/ucar/metviewer/log4j2.xml b/java/edu/ucar/metviewer/log4j2.xml index 002a2b1b..c5c00cda 100644 --- a/java/edu/ucar/metviewer/log4j2.xml +++ b/java/edu/ucar/metviewer/log4j2.xml @@ -1,10 +1,11 @@ + + pattern="%style{%d{ISO8601}}{black} %highlight{%-5level }[%style{%L}{blue}] [%style{%M}{bright,blue}] %style{%C{1.}}{bright,yellow} %style{METviewer}{bright,green} %style{[%X{hostName}]}{bright,red} %msg%n%throwable%n" /> diff --git a/webapp/metviewer/WEB-INF/classes/log4j2.xml b/webapp/metviewer/WEB-INF/classes/log4j2.xml index 2734a67d..aa47e6f4 100644 --- a/webapp/metviewer/WEB-INF/classes/log4j2.xml +++ b/webapp/metviewer/WEB-INF/classes/log4j2.xml @@ -3,12 +3,12 @@ + pattern="%style{%d{ISO8601}}{black} %highlight{%-5level }[%style{%L}{blue}] [%style{%M}{bright,blue}] %style{%C{1.}}{bright,yellow} %style{METviewer}{bright,green} %style{[${env:HOSTNAME:-None}]}{bright,red} %msg%n%throwable%n" /> - + diff --git a/webapp/metviewer/WEB-INF/classes/log4j2.xml.orig b/webapp/metviewer/WEB-INF/classes/log4j2.xml.orig index 2734a67d..59ae37de 100644 --- a/webapp/metviewer/WEB-INF/classes/log4j2.xml.orig +++ b/webapp/metviewer/WEB-INF/classes/log4j2.xml.orig @@ -3,12 +3,12 @@ + pattern="%style{%d{ISO8601}}{black} %highlight{%-5level }[%style{%L}{blue}] [%style{%M}{bright,blue}] %style{%C{1.}}{bright,yellow} %style{METviewer}{bright,green} %style{[${env:HOSTNAME:-None}]}{bright,red} %msg%n%throwable%n" /> - + @@ -18,4 +18,4 @@ - \ No newline at end of file +