Commit 5d3c344e8bd974c40670341207ef55186b9ce1aa
1 parent
4ca7853c
Exists in
master
Use Java logging API instead of log4j.
Showing
17 changed files
with
90 additions
and
199 deletions
Show diff stats
log4j2.xml deleted
... | ... | @@ -1,17 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<Configuration> | |
3 | - <Appenders> | |
4 | - <Console name="Console"> | |
5 | - <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} %p %c{1.} [%t] %m%n}{STYLE=Logback}"/> | |
6 | - </Console> | |
7 | - <File name="File" fileName="/tmp/EpnTAPClient.log"> | |
8 | - <PatternLayout pattern="%d{HH:mm:ss.SSS} %p %c{1.} [%t] %m%n"/> | |
9 | - </File> | |
10 | - </Appenders> | |
11 | - <Loggers> | |
12 | - <Root level="trace"> | |
13 | - <AppenderRef ref="Console"/> | |
14 | - <AppenderRef ref="File"/> | |
15 | - </Root> | |
16 | - </Loggers> | |
17 | -</Configuration> |
pom.xml
... | ... | @@ -90,17 +90,6 @@ |
90 | 90 | <version>1.7</version> |
91 | 91 | <executions> |
92 | 92 | <execution> |
93 | - <phase>process-classes</phase> | |
94 | - <configuration> | |
95 | - <tasks> | |
96 | - <copy file="${basedir}/log4j2.xml" todir="${basedir}/target/classes/" /> | |
97 | - </tasks> | |
98 | - </configuration> | |
99 | - <goals> | |
100 | - <goal>run</goal> | |
101 | - </goals> | |
102 | - </execution> | |
103 | - <execution> | |
104 | 93 | <id>remove-episode</id> |
105 | 94 | <phase>process-sources</phase> |
106 | 95 | <goals> |
... | ... | @@ -191,16 +180,6 @@ |
191 | 180 | <version>2.2.2</version> |
192 | 181 | <scope>compile</scope> |
193 | 182 | </dependency> |
194 | - <dependency> | |
195 | - <groupId>org.apache.logging.log4j</groupId> | |
196 | - <artifactId>log4j-api</artifactId> | |
197 | - <version>2.5</version> | |
198 | - </dependency> | |
199 | - <dependency> | |
200 | - <groupId>org.apache.logging.log4j</groupId> | |
201 | - <artifactId>log4j-core</artifactId> | |
202 | - <version>2.5</version> | |
203 | - </dependency> | |
204 | 183 | </dependencies> |
205 | 184 | <profiles> |
206 | 185 | <profile> | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
... | ... | @@ -16,12 +16,11 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient; |
18 | 18 | |
19 | +import java.util.logging.Logger; | |
20 | + | |
19 | 21 | import javax.swing.JFrame; |
20 | 22 | import javax.swing.SwingUtilities; |
21 | 23 | |
22 | -import org.apache.logging.log4j.LogManager; | |
23 | -import org.apache.logging.log4j.Logger; | |
24 | - | |
25 | 24 | import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; |
26 | 25 | |
27 | 26 | /** |
... | ... | @@ -30,9 +29,8 @@ import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; |
30 | 29 | * @author N. Jourdane |
31 | 30 | */ |
32 | 31 | public class EpnTapMainApp { |
33 | - | |
34 | - /** The logger for this class. */ | |
35 | - private static final Logger logger = LogManager.getRootLogger(); | |
32 | + /** The logger for the class EpnTapMainApp. */ | |
33 | + private static final Logger logger = Logger.getLogger(EpnTapMainApp.class.getName()); | |
36 | 34 | |
37 | 35 | /** Constructor to hide the implicit public one. */ |
38 | 36 | private EpnTapMainApp() { | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
... | ... | @@ -16,8 +16,7 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.controller; |
18 | 18 | |
19 | -import org.apache.logging.log4j.LogManager; | |
20 | -import org.apache.logging.log4j.Logger; | |
19 | +import java.util.logging.Logger; | |
21 | 20 | |
22 | 21 | import eu.omp.irap.vespa.epntapclient.utils.Const; |
23 | 22 | import eu.omp.irap.vespa.epntapclient.utils.Queries; |
... | ... | @@ -30,8 +29,8 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; |
30 | 29 | * @author N. Jourdane |
31 | 30 | */ |
32 | 31 | public class EpnTapController { |
33 | - /** The logger for this class. */ | |
34 | - private static final Logger logger = LogManager.getLogger(EpnTapController.class); | |
32 | + /** The logger for the class EpnTapController. */ | |
33 | + Logger logger = Logger.getLogger(EpnTapController.class.getName()); | |
35 | 34 | |
36 | 35 | /** The view of EPN-TAP application. */ |
37 | 36 | EpnTapMainView view; |
... | ... | @@ -52,8 +51,6 @@ public class EpnTapController { |
52 | 51 | * Method constructor |
53 | 52 | */ |
54 | 53 | public EpnTapController() { |
55 | - | |
56 | - // TODO: Get only *EPN* TAP services | |
57 | 54 | servicesController = new VOTableController(Const.DEFAULT_REGISTRY_URL, "ADQL", |
58 | 55 | Queries.GET_EPN_TAP_SERVICES); |
59 | 56 | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java deleted
... | ... | @@ -1,75 +0,0 @@ |
1 | -/* | |
2 | - * This file is a part of EpnTAPClient. | |
3 | - * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | |
4 | - * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | |
5 | - * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planรฉtologie. | |
6 | - * | |
7 | - * This program is free software: you can | |
8 | - * redistribute it and/or modify it under the terms of the GNU General Public License as published | |
9 | - * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
10 | - * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
12 | - * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | |
13 | - * the GNU General Public License along with this program. If not, see | |
14 | - * <http://www.gnu.org/licenses/>. | |
15 | - */ | |
16 | - | |
17 | -package eu.omp.irap.vespa.epntapclient.utils; | |
18 | - | |
19 | -import java.io.FileWriter; | |
20 | -import java.io.IOException; | |
21 | - | |
22 | -import org.apache.logging.log4j.LogManager; | |
23 | -import org.apache.logging.log4j.Logger; | |
24 | - | |
25 | -import com.google.gson.Gson; | |
26 | -import com.google.gson.GsonBuilder; | |
27 | - | |
28 | -import eu.omp.irap.vespa.epntapclient.EpnTapMainApp; | |
29 | - | |
30 | -/** | |
31 | - * Simple class to provide logging features | |
32 | - * | |
33 | - * @author N. Jourdane | |
34 | - */ | |
35 | -public class Log { | |
36 | - /** The logger for this class. */ | |
37 | - private static final Logger logger = LogManager.getLogger(EpnTapMainApp.class); | |
38 | - | |
39 | - /** Constructor to hide the implicit public one. */ | |
40 | - private Log() { | |
41 | - } | |
42 | - | |
43 | - /** | |
44 | - * Print the specified object in JSON format in a file on the temp directory. The default file | |
45 | - * name is "object.json" | |
46 | - * | |
47 | - * @param obj the object to print in a file. | |
48 | - * @return The path of the file. | |
49 | - */ | |
50 | - public static String printObject(Object obj) { | |
51 | - return printObject("object", obj); | |
52 | - } | |
53 | - | |
54 | - /** | |
55 | - * Print the specified object in JSON format in a file on the temp directory. | |
56 | - * | |
57 | - * @param title The name of the file. | |
58 | - * @param obj the object to print in a file. | |
59 | - * @return The path of the file. | |
60 | - */ | |
61 | - public static String printObject(String title, Object obj) { | |
62 | - Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
63 | - String json = gson.toJson(obj); | |
64 | - String path = Const.TMP_DIR + "/" + title + ".json"; | |
65 | - try (FileWriter writer = new FileWriter(path)) { | |
66 | - writer.write(json); | |
67 | - | |
68 | - } catch (IOException e) { | |
69 | - logger.error("Can not print in the file " + path, e); | |
70 | - } | |
71 | - | |
72 | - return path; | |
73 | - } | |
74 | - | |
75 | -} |
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
... | ... | @@ -19,6 +19,7 @@ package eu.omp.irap.vespa.epntapclient.utils; |
19 | 19 | import java.util.ArrayList; |
20 | 20 | import java.util.List; |
21 | 21 | import java.util.Map; |
22 | +import java.util.logging.Logger; | |
22 | 23 | |
23 | 24 | import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner; |
24 | 25 | |
... | ... | @@ -26,6 +27,8 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner; |
26 | 27 | * @author N. Jourdane |
27 | 28 | */ |
28 | 29 | public final class Queries { |
30 | + /** The logger for the class Queries. */ | |
31 | + Logger logger = Logger.getLogger(Queries.class.getName()); | |
29 | 32 | |
30 | 33 | // AMDA access_url: http://cdpp-epntap.cesr.fr/__system__/tap/run/tap |
31 | 34 | // AMDA table name: amdadb.epn_core | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
... | ... | @@ -18,6 +18,7 @@ package eu.omp.irap.vespa.epntapclient.view; |
18 | 18 | |
19 | 19 | import java.awt.BorderLayout; |
20 | 20 | import java.awt.Dimension; |
21 | +import java.util.logging.Logger; | |
21 | 22 | |
22 | 23 | import javax.swing.JOptionPane; |
23 | 24 | import javax.swing.JPanel; |
... | ... | @@ -25,9 +26,6 @@ import javax.swing.JSplitPane; |
25 | 26 | import javax.swing.event.ListSelectionEvent; |
26 | 27 | import javax.swing.event.ListSelectionListener; |
27 | 28 | |
28 | -import org.apache.logging.log4j.LogManager; | |
29 | -import org.apache.logging.log4j.Logger; | |
30 | - | |
31 | 29 | import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; |
32 | 30 | import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; |
33 | 31 | |
... | ... | @@ -35,9 +33,8 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; |
35 | 33 | * @author N. Jourdane |
36 | 34 | */ |
37 | 35 | public class EpnTapMainView extends JPanel { |
38 | - | |
39 | - /** The logger for this class. */ | |
40 | - static final Logger logger = LogManager.getLogger(EpnTapMainView.class); | |
36 | + /** The logger for the class EpnTapMainView. */ | |
37 | + private static final Logger logger = Logger.getLogger(EpnTapMainView.class.getName()); | |
41 | 38 | |
42 | 39 | /** The serial version UID (affected with a random number). */ |
43 | 40 | private static final long serialVersionUID = -1233290271099283814L; | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java
... | ... | @@ -11,6 +11,7 @@ import java.util.ArrayList; |
11 | 11 | import java.util.HashMap; |
12 | 12 | import java.util.List; |
13 | 13 | import java.util.Locale; |
14 | +import java.util.logging.Logger; | |
14 | 15 | |
15 | 16 | import javax.swing.BoxLayout; |
16 | 17 | import javax.swing.JComboBox; |
... | ... | @@ -21,9 +22,6 @@ import javax.swing.SwingUtilities; |
21 | 22 | import javax.swing.event.DocumentEvent; |
22 | 23 | import javax.swing.event.DocumentListener; |
23 | 24 | |
24 | -import org.apache.logging.log4j.LogManager; | |
25 | -import org.apache.logging.log4j.Logger; | |
26 | - | |
27 | 25 | import com.google.gson.JsonArray; |
28 | 26 | import com.google.gson.JsonObject; |
29 | 27 | import com.google.gson.JsonParser; |
... | ... | @@ -33,9 +31,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.BadReq |
33 | 31 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.HTTPRequestException; |
34 | 32 | |
35 | 33 | public abstract class ParamField extends JPanel { |
36 | - | |
37 | - /** The logger for this class. */ | |
38 | - private static final Logger logger = LogManager.getLogger(ParamField.class); | |
34 | + /** The logger for the class ParamField. */ | |
35 | + private static final Logger logger = Logger.getLogger(ParamField.class.getName()); | |
39 | 36 | |
40 | 37 | private static final int MIN_FIELD_WIDTH = 30; |
41 | 38 | private static final int FIELD_HEIGHT = 20; |
... | ... | @@ -204,7 +201,7 @@ public abstract class ParamField extends JPanel { |
204 | 201 | try { |
205 | 202 | resolverResult = VOTableConnection.sendGet(RESOLVER_URL, "q=\"" + begining + "\""); |
206 | 203 | } catch (HTTPRequestException | BadRequestException e) { |
207 | - logger.fatal("Can not send sersolver query: ", e); | |
204 | + logger.severe("Can not send sersolver query: " + e); | |
208 | 205 | } |
209 | 206 | JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject(); |
210 | 207 | int count = Integer.parseInt(root.get("count").toString()); | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java
... | ... | @@ -24,6 +24,7 @@ import java.util.ArrayList; |
24 | 24 | import java.util.HashMap; |
25 | 25 | import java.util.List; |
26 | 26 | import java.util.Map; |
27 | +import java.util.logging.Logger; | |
27 | 28 | |
28 | 29 | import javax.swing.BorderFactory; |
29 | 30 | import javax.swing.BoxLayout; |
... | ... | @@ -31,9 +32,6 @@ import javax.swing.JButton; |
31 | 32 | import javax.swing.JPanel; |
32 | 33 | import javax.swing.JTextArea; |
33 | 34 | |
34 | -import org.apache.logging.log4j.LogManager; | |
35 | -import org.apache.logging.log4j.Logger; | |
36 | - | |
37 | 35 | import eu.omp.irap.vespa.epntapclient.utils.Queries; |
38 | 36 | import eu.omp.irap.vespa.epntapclient.view.ParamField.DataProductTypeField; |
39 | 37 | import eu.omp.irap.vespa.epntapclient.view.ParamField.DateRangeField; |
... | ... | @@ -45,9 +43,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; |
45 | 43 | * @author N. Jourdane |
46 | 44 | */ |
47 | 45 | public class RequestView extends JPanel implements ActionListener { |
48 | - | |
49 | - /** The logger for this class. */ | |
50 | - private static final Logger logger = LogManager.getLogger(RequestView.class); | |
46 | + /** The logger for the class RequestView. */ | |
47 | + private static final Logger logger = Logger.getLogger(RequestView.class.getName()); | |
51 | 48 | |
52 | 49 | /** The serial version UID (affected with a random number). */ |
53 | 50 | private static final long serialVersionUID = 1262856496809315405L; |
... | ... | @@ -169,7 +166,7 @@ public class RequestView extends JPanel implements ActionListener { |
169 | 166 | try { |
170 | 167 | mainView.getController().sendQuery(queryArea.getText()); |
171 | 168 | } catch (VOTableException e) { |
172 | - logger.error("Can not send query when clicking on the send button.", e); | |
169 | + logger.warning("Can not send query when clicking on the send button." + e); | |
173 | 170 | } |
174 | 171 | } |
175 | 172 | } | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/Utils.java
... | ... | @@ -16,13 +16,24 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable; |
18 | 18 | |
19 | +import java.io.FileWriter; | |
20 | +import java.io.IOException; | |
19 | 21 | import java.util.ArrayList; |
20 | 22 | import java.util.List; |
23 | +import java.util.logging.Logger; | |
24 | + | |
25 | +import com.google.gson.Gson; | |
26 | +import com.google.gson.GsonBuilder; | |
27 | + | |
28 | +import eu.omp.irap.vespa.epntapclient.utils.Const; | |
21 | 29 | |
22 | 30 | /** |
23 | 31 | * @author N. Jourdane |
24 | 32 | */ |
25 | 33 | public class Utils { |
34 | + /** The logger for the class Utils. */ | |
35 | + private static final Logger logger = Logger.getLogger(Utils.class.getName()); | |
36 | + | |
26 | 37 | public static class StringJoiner { |
27 | 38 | String separator; |
28 | 39 | List<String> list; |
... | ... | @@ -47,4 +58,27 @@ public class Utils { |
47 | 58 | return string; |
48 | 59 | } |
49 | 60 | } |
61 | + | |
62 | + /** | |
63 | + * Print the specified object in JSON format in a file on the temp directory. | |
64 | + * | |
65 | + * @param title The name of the file. | |
66 | + * @param obj the object to print in a file. | |
67 | + * @return The path of the file. | |
68 | + */ | |
69 | + public static String printObject(String title, Object obj) { | |
70 | + Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
71 | + String json = gson.toJson(obj); | |
72 | + String path = Const.TMP_DIR + "/" + title + ".json"; | |
73 | + try (FileWriter writer = new FileWriter(path)) { | |
74 | + writer.write(json); | |
75 | + | |
76 | + } catch (IOException e) { | |
77 | + logger.warning("Can not print in the file " + path + e); | |
78 | + } | |
79 | + logger.info("A json file representing " + title + " (" + obj.getClass().getName() | |
80 | + + ") has been created on " + path); | |
81 | + | |
82 | + return path; | |
83 | + } | |
50 | 84 | } | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/VOTableApp.java
... | ... | @@ -16,12 +16,11 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable; |
18 | 18 | |
19 | +import java.util.logging.Logger; | |
20 | + | |
19 | 21 | import javax.swing.JFrame; |
20 | 22 | import javax.swing.SwingUtilities; |
21 | 23 | |
22 | -import org.apache.logging.log4j.LogManager; | |
23 | -import org.apache.logging.log4j.Logger; | |
24 | - | |
25 | 24 | import com.google.gson.Gson; |
26 | 25 | |
27 | 26 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; |
... | ... | @@ -32,9 +31,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; |
32 | 31 | * @author N. Jourdane |
33 | 32 | */ |
34 | 33 | public class VOTableApp { |
35 | - | |
36 | - /** The logger for this class. */ | |
37 | - static final Logger logger = LogManager.getLogger(VOTableApp.class); | |
34 | + /** The logger for the class VOTableApp. */ | |
35 | + private static final Logger logger = Logger.getLogger(VOTableApp.class.getName()); | |
38 | 36 | |
39 | 37 | /** |
40 | 38 | * Main function to start the application as standalone. | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java
... | ... | @@ -28,9 +28,7 @@ import java.net.URL; |
28 | 28 | import java.net.URLEncoder; |
29 | 29 | import java.text.SimpleDateFormat; |
30 | 30 | import java.util.Date; |
31 | - | |
32 | -import org.apache.logging.log4j.LogManager; | |
33 | -import org.apache.logging.log4j.Logger; | |
31 | +import java.util.logging.Logger; | |
34 | 32 | |
35 | 33 | import eu.omp.irap.vespa.epntapclient.utils.Const; |
36 | 34 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.BadRequestException; |
... | ... | @@ -42,9 +40,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.HTTPRe |
42 | 40 | * @author N. Jourdane |
43 | 41 | */ |
44 | 42 | public final class VOTableConnection { |
45 | - | |
46 | - /** The logger for this class. */ | |
47 | - private static final Logger logger = LogManager.getLogger(VOTableConnection.class); | |
43 | + /** The logger for the class VOTableConnection. */ | |
44 | + private static final Logger logger = Logger.getLogger(VOTableConnection.class.getName()); | |
48 | 45 | |
49 | 46 | /** The user agent used for the requests. */ |
50 | 47 | private static final String USER_AGENT = "Mozilla/5.0"; | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableController.java
... | ... | @@ -17,9 +17,7 @@ |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable.controller; |
18 | 18 | |
19 | 19 | import java.io.IOException; |
20 | - | |
21 | -import org.apache.logging.log4j.LogManager; | |
22 | -import org.apache.logging.log4j.Logger; | |
20 | +import java.util.logging.Logger; | |
23 | 21 | |
24 | 22 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.VOTableParsingException; |
25 | 23 | import eu.omp.irap.vespa.epntapclient.votable.model.Table; |
... | ... | @@ -30,9 +28,8 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; |
30 | 28 | * @author N. Jourdane |
31 | 29 | */ |
32 | 30 | public class VOTableController { |
33 | - | |
34 | - /** The logger for this class. */ | |
35 | - private static final Logger logger = LogManager.getLogger(VOTableController.class); | |
31 | + /** The logger for the class VOTableController. */ | |
32 | + private static final Logger logger = Logger.getLogger(VOTableController.class.getName()); | |
36 | 33 | |
37 | 34 | /** The view of the VOTable */ |
38 | 35 | VOTableView view; | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableDataParser.java
... | ... | @@ -22,15 +22,13 @@ import java.util.ArrayList; |
22 | 22 | import java.util.HashMap; |
23 | 23 | import java.util.List; |
24 | 24 | import java.util.Map; |
25 | +import java.util.logging.Logger; | |
25 | 26 | |
26 | 27 | import javax.xml.bind.DatatypeConverter; |
27 | 28 | |
28 | -import org.apache.logging.log4j.LogManager; | |
29 | -import org.apache.logging.log4j.Logger; | |
30 | - | |
31 | 29 | import com.google.gson.Gson; |
32 | 30 | |
33 | -import eu.omp.irap.vespa.epntapclient.utils.Log; | |
31 | +import eu.omp.irap.vespa.epntapclient.votable.Utils; | |
34 | 32 | import eu.omp.irap.vespa.epntapclient.votable.model.DataType; |
35 | 33 | import eu.omp.irap.vespa.epntapclient.votable.model.Field; |
36 | 34 | import eu.omp.irap.vespa.epntapclient.votable.model.Stream; |
... | ... | @@ -41,9 +39,8 @@ import eu.omp.irap.vespa.epntapclient.votable.model.TableData; |
41 | 39 | * @author N. Jourdane |
42 | 40 | */ |
43 | 41 | public class VOTableDataParser { |
44 | - | |
45 | - /** The logger for this class. */ | |
46 | - private static final Logger logger = LogManager.getLogger(VOTableDataParser.class); | |
42 | + /** The logger for the class VOTableDataParser. */ | |
43 | + private static final Logger logger = Logger.getLogger(VOTableDataParser.class.getName()); | |
47 | 44 | |
48 | 45 | /** |
49 | 46 | * A list of arrays, representing data stored in the VOTable. Each element is a VOTable row, |
... | ... | @@ -95,8 +92,7 @@ public class VOTableDataParser { |
95 | 92 | parseFITSStream(table.getDATA().getFITS().getSTREAM(), fields); |
96 | 93 | } |
97 | 94 | |
98 | - String logPath = Log.printObject(data); | |
99 | - logger.info("A json file representing the VOTable data has been created on " + logPath); | |
95 | + String logPath = Utils.printObject("voTableData", data); | |
100 | 96 | } |
101 | 97 | |
102 | 98 | /** |
... | ... | @@ -256,7 +252,7 @@ public class VOTableDataParser { |
256 | 252 | } else if (dataType.equals(DataType.DOUBLE)) { |
257 | 253 | row[nColumn] = stream.getDouble(); |
258 | 254 | } else { |
259 | - logger.warn("Data type " + dataType + " is not supprted."); | |
255 | + logger.warning("Data type " + dataType + " is not supported."); | |
260 | 256 | } |
261 | 257 | |
262 | 258 | // logger.debug(columnsName[nColumn] + ": " + row[nColumn]) | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableException.java
... | ... | @@ -16,8 +16,7 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable.controller; |
18 | 18 | |
19 | -import org.apache.logging.log4j.LogManager; | |
20 | -import org.apache.logging.log4j.Logger; | |
19 | +import java.util.logging.Logger; | |
21 | 20 | |
22 | 21 | /** |
23 | 22 | * VOTable Exception class. |
... | ... | @@ -26,42 +25,41 @@ import org.apache.logging.log4j.Logger; |
26 | 25 | */ |
27 | 26 | @SuppressWarnings({ "javadoc", "serial" }) |
28 | 27 | public class VOTableException extends Exception { |
29 | - | |
30 | - /** The logger for this class. */ | |
31 | - static final Logger logger = LogManager.getLogger(VOTableException.class); | |
28 | + /** The logger for the class VOTableException. */ | |
29 | + private static final Logger logger = Logger.getLogger(VOTableException.class.getName()); | |
32 | 30 | |
33 | 31 | /** The log message displayed when errors appends. */ |
34 | 32 | private static final String ERROR_MSG = "-- error --\n%1s\nbecause:\n%2s\n-- end of error --\n"; |
35 | 33 | |
36 | 34 | public VOTableException() { |
37 | - logger.error("A VOTable error occured."); | |
35 | + logger.warning("A VOTable error occured."); | |
38 | 36 | } |
39 | 37 | |
40 | 38 | public VOTableException(String message) { |
41 | - logger.error(message); | |
39 | + logger.warning(message); | |
42 | 40 | } |
43 | 41 | |
44 | 42 | public VOTableException(String message, Exception e) { |
45 | - logger.error(String.format(ERROR_MSG, message, e.getMessage())); | |
43 | + logger.warning(String.format(ERROR_MSG, message, e.getMessage())); | |
46 | 44 | } |
47 | 45 | |
48 | 46 | public VOTableException(Exception e) { |
49 | - logger.error(e.getMessage()); | |
47 | + logger.warning(e.getMessage()); | |
50 | 48 | } |
51 | 49 | |
52 | 50 | public static class HTTPRequestException extends VOTableException { |
53 | 51 | public HTTPRequestException(String message) { |
54 | - logger.error(message); | |
52 | + logger.warning(message); | |
55 | 53 | } |
56 | 54 | |
57 | 55 | public HTTPRequestException(String message, Exception e) { |
58 | - logger.error(String.format(ERROR_MSG, message, e.getMessage())); | |
56 | + logger.warning(String.format(ERROR_MSG, message, e.getMessage())); | |
59 | 57 | } |
60 | 58 | } |
61 | 59 | |
62 | 60 | public static class VOTableParsingException extends VOTableException { |
63 | 61 | public VOTableParsingException(String message, Exception e) { |
64 | - logger.error(String.format(ERROR_MSG, message, e.getMessage())); | |
62 | + logger.warning(String.format(ERROR_MSG, message, e.getMessage())); | |
65 | 63 | } |
66 | 64 | } |
67 | 65 | |
... | ... | @@ -71,7 +69,7 @@ public class VOTableException extends Exception { |
71 | 69 | public BadRequestException(String message, String info) { |
72 | 70 | super(message); |
73 | 71 | this.info = info; |
74 | - logger.error(message + "\nDetails: " + info); | |
72 | + logger.warning(message + "\nDetails: " + info); | |
75 | 73 | } |
76 | 74 | |
77 | 75 | public String getInfo() { | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableParser.java
... | ... | @@ -18,6 +18,7 @@ package eu.omp.irap.vespa.epntapclient.votable.controller; |
18 | 18 | |
19 | 19 | import java.io.File; |
20 | 20 | import java.io.IOException; |
21 | +import java.util.logging.Logger; | |
21 | 22 | |
22 | 23 | import javax.xml.bind.JAXBContext; |
23 | 24 | import javax.xml.bind.JAXBException; |
... | ... | @@ -31,8 +32,6 @@ import javax.xml.transform.TransformerFactory; |
31 | 32 | import javax.xml.transform.dom.DOMSource; |
32 | 33 | import javax.xml.transform.stream.StreamResult; |
33 | 34 | |
34 | -import org.apache.logging.log4j.LogManager; | |
35 | -import org.apache.logging.log4j.Logger; | |
36 | 35 | import org.w3c.dom.Document; |
37 | 36 | import org.w3c.dom.NamedNodeMap; |
38 | 37 | import org.xml.sax.SAXException; |
... | ... | @@ -44,9 +43,8 @@ import eu.omp.irap.vespa.epntapclient.votable.model.VOTABLE; |
44 | 43 | * @author N. Jourdane |
45 | 44 | */ |
46 | 45 | public final class VOTableParser { |
47 | - | |
48 | - /** The logger for this class. */ | |
49 | - static final Logger logger = LogManager.getLogger(VOTableParser.class); | |
46 | + /** The logger for the class VOTableParser. */ | |
47 | + private static final Logger logger = Logger.getLogger(VOTableParser.class.getName()); | |
50 | 48 | |
51 | 49 | /** The path of the VOTable to verify the VOTable XML file. */ |
52 | 50 | private static final String VOTABLE_SHEMA = "http://www.ivoa.net/xml/VOTable/v"; | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
... | ... | @@ -18,6 +18,7 @@ package eu.omp.irap.vespa.epntapclient.votable.view; |
18 | 18 | |
19 | 19 | import java.awt.BorderLayout; |
20 | 20 | import java.util.List; |
21 | +import java.util.logging.Logger; | |
21 | 22 | |
22 | 23 | import javax.swing.JOptionPane; |
23 | 24 | import javax.swing.JPanel; |
... | ... | @@ -28,18 +29,14 @@ import javax.swing.event.TableModelEvent; |
28 | 29 | import javax.swing.event.TableModelListener; |
29 | 30 | import javax.swing.table.DefaultTableModel; |
30 | 31 | |
31 | -import org.apache.logging.log4j.LogManager; | |
32 | -import org.apache.logging.log4j.Logger; | |
33 | - | |
34 | 32 | /** |
35 | 33 | * The main class of the View of the application. |
36 | 34 | * |
37 | 35 | * @author N. Jourdane |
38 | 36 | */ |
39 | 37 | public class VOTableView extends JPanel implements TableModelListener { |
40 | - | |
41 | - /** The logger for this class. */ | |
42 | - static final Logger logger = LogManager.getLogger(VOTableView.class); | |
38 | + /** The logger for the class VOTableView. */ | |
39 | + private static final Logger logger = Logger.getLogger(VOTableView.class.getName()); | |
43 | 40 | |
44 | 41 | // TODO: Create classes VOTableGUI and VOTableCLI which implements an interface VOTableView |
45 | 42 | /** The serial version UID (affected with a random number). */ |
... | ... | @@ -110,7 +107,7 @@ public class VOTableView extends JPanel implements TableModelListener { |
110 | 107 | */ |
111 | 108 | public void displayError(String message) { |
112 | 109 | JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); |
113 | - logger.warn(message); | |
110 | + logger.warning(message); | |
114 | 111 | } |
115 | 112 | |
116 | 113 | /** |
... | ... | @@ -122,7 +119,7 @@ public class VOTableView extends JPanel implements TableModelListener { |
122 | 119 | public void displayError(String message, Exception e) { |
123 | 120 | String error_msg = "-- user error --\n%1s\nbecause:\n%2s\n-- end of user error --\n"; |
124 | 121 | JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); |
125 | - logger.warn(String.format(error_msg, message, e.getMessage())); | |
122 | + logger.warning(String.format(error_msg, message, e.getMessage())); | |
126 | 123 | } |
127 | 124 | |
128 | 125 | @Override | ... | ... |