Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fiqare perseo-core improvements #151

Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6d25f8d
Add JaCoCo plugin
fiqare-emergya-dev Feb 5, 2019
ab122f2
Merge pull request #2 from Emergya/configuration-branch
fiqare-emergya-dev Feb 6, 2019
f651423
#284620
fiqare-emergya-dev Feb 6, 2019
a1c8d23
Delete innecesary comments
fiqare-emergya-dev Feb 7, 2019
fa2197f
Merge pull request #3 from Emergya/configuration-branch
fiqare-emergya-dev Feb 7, 2019
99263f2
Merge pull request #4 from Emergya/284620
fiqare-emergya-dev Feb 7, 2019
5c7825b
#284620
fiqare-emergya-dev Feb 11, 2019
cbfad26
Merge pull request #5 from Emergya/284620
fiqare-emergya-dev Feb 11, 2019
18d5393
Fixed Dockerfile
fiqare-emergya-dev Feb 11, 2019
c4c89f3
Fixed Dockerfile
fiqare-emergya-dev Feb 11, 2019
04e9cbb
284621
fiqare-emergya-dev Feb 11, 2019
e90be87
284621
fiqare-emergya-dev Feb 11, 2019
9dc7421
Fixed Dockerfile
fiqare-emergya-dev Feb 12, 2019
032f6b8
Merge pull request #7 from Emergya/Dockerfile-fixed
fiqare-emergya-dev Feb 12, 2019
c361bf3
Merge pull request #9 from Emergya/284621
fiqare-emergya-dev Feb 12, 2019
8ff7828
Add 'default' clauses
fiqare-emergya-dev Feb 14, 2019
8050a3d
Added comment in default clauses
fiqare-emergya-dev Feb 14, 2019
86f9044
Merge pull request #10 from Emergya/defaultclauses#284631
fiqare-emergya-dev Feb 14, 2019
6fa32ad
Fill in the empty statements
fiqare-emergya-dev Feb 14, 2019
7de5632
Merge branch 'ci' of https://github.com/Emergya/cdti-fiqare-perseo-co…
fiqare-emergya-dev Feb 14, 2019
40094b8
Merge pull request #11 from Emergya/emptystatements#284630
fiqare-emergya-dev Feb 14, 2019
3e386ac
Refactor code
fiqare-emergya-dev Feb 14, 2019
2ad08b7
Merge pull request #12 from Emergya/emptystatements#284630
fiqare-emergya-dev Feb 14, 2019
bc7419d
Separate variables
fiqare-emergya-dev Feb 15, 2019
30ef6b4
Merge pull request #13 from Emergya/multiplevariables#284636
fiqare-emergya-dev Feb 15, 2019
4ab8d47
Fixed issue #284627 in src/main/java/com/telefonica/iot/perseo/Events…
fiqare-emergya-dev Feb 26, 2019
149d591
Fixed issue #284627 in pom.xml
fiqare-emergya-dev Feb 26, 2019
cd90313
Merge pull request #14 from Emergya/284627
fiqare-emergya-dev Feb 26, 2019
5e43ec8
Fixed issue #284639 in src/main/java/com/telefonica/iot/perseo/Config…
fiqare-emergya-dev Feb 27, 2019
65ac79d
Merge pull request #15 from Emergya/284639
fiqare-emergya-dev Feb 27, 2019
7ccb457
Merge pull request #16 from telefonicaid/master
fiqare-emergya-dev Mar 18, 2019
c0dfb12
Merge pull request #17 from Emergya/master
fiqare-emergya-dev Mar 18, 2019
dd1ad0e
fixed issues EventsServlet.java #~290936
fiqare-emergya-dev Mar 19, 2019
5852c95
fixed issues GenericListener #290956
fiqare-emergya-dev Mar 19, 2019
0ac3d7e
#291109
fiqare-emergya-dev Mar 19, 2019
33c8328
Merge pull request #18 from Emergya/ci
fiqare-emergya-dev Mar 20, 2019
e53c7eb
fixed issues Configuration #291280
fiqare-emergya-dev Mar 20, 2019
4eb356c
fixed issues EventsServlet #290936
fiqare-emergya-dev Mar 20, 2019
7883507
fixed issues LogLevelServlet #291283
fiqare-emergya-dev Mar 20, 2019
1395a50
fixed issues RulesManager #290959
fiqare-emergya-dev Mar 20, 2019
b510393
fixed issues RulesServlet #291109
fiqare-emergya-dev Mar 20, 2019
4ddbdb4
fixed issues TimeRulesStore #291284
fiqare-emergya-dev Mar 20, 2019
6e26193
fixed issues Utils #~91285
fiqare-emergya-dev Mar 20, 2019
5adca52
fixed issues JSONArray #291298
fiqare-emergya-dev Mar 20, 2019
f73d8f1
fixed issues JSONObject #291299
fiqare-emergya-dev Mar 20, 2019
d08fdcd
fixed issues Kim 291301
fiqare-emergya-dev Mar 20, 2019
b694d53
fixed issues EventsServletTest #291302
fiqare-emergya-dev Mar 20, 2019
ed78f2f
fixed issues GenericListenerTest #291303
fiqare-emergya-dev Mar 20, 2019
8e42d0e
fixed issues LogLevelServletTest #291304
fiqare-emergya-dev Mar 20, 2019
f94f1bf
fixed issues RulesManagerTest #291305
fiqare-emergya-dev Mar 20, 2019
b38f18b
fixed issues TimeRulesStoreTest #291306
fiqare-emergya-dev Mar 20, 2019
5491d95
fixed issues TimeRulesStoreTest #291306
fiqare-emergya-dev Mar 20, 2019
fb3005d
fixed issues UtilsTest #291307
fiqare-emergya-dev Mar 20, 2019
a17edf1
fixed issues Help.java #291308
fiqare-emergya-dev Mar 20, 2019
9eb801a
merge with ci brunch
fiqare-emergya-dev Mar 20, 2019
0413a41
merged with ci branch
fiqare-emergya-dev Mar 20, 2019
5b174d7
Merge pull request #19 from Emergya/284645
fiqare-emergya-dev Mar 20, 2019
6ad2461
Merge pull request #20 from Emergya/ci
fiqare-emergya-dev Mar 20, 2019
97b23e9
Updated to 1.4.0 release from telefonicaid/perseo-core
fiqare-emergya-dev Nov 21, 2019
7a1e6e5
Merge branch 'telefonicaid-release/1.4.0'
fiqare-emergya-dev Nov 21, 2019
90a8cba
Travis I
fiqare-emergya-dev Nov 21, 2019
5c7b891
Travis CI
fiqare-emergya-dev Nov 21, 2019
64f4713
Fixed Travis errors
fiqare-emergya-dev Nov 21, 2019
a5ff18a
Fixed Travis errors(2)
fiqare-emergya-dev Nov 21, 2019
660056e
Fixed org.json dependency
fiqare-emergya-dev Dec 17, 2019
654f7bc
Merged with telefonica master
fiqare-emergya-dev Dec 17, 2019
d3cd3f4
Merge branch 'telefonicaid-master' into fiqare-perseo-core-improvements
fiqare-emergya-dev Dec 17, 2019
4d08aff
Fixes
fiqare-emergya-dev Dec 17, 2019
05982ba
pr fixes
fiqare-emergya-dev Jan 16, 2020
c8154a4
Merge pull request #3 from telefonicaid/master
fiqare-emergya-dev Jan 16, 2020
61b8a4c
pr fixes
fiqare-emergya-dev Jan 23, 2020
cff907d
Merge branch 'fiqare-perseo-core-improvements' of https://github.com/…
fiqare-emergya-dev Jan 23, 2020
47ab836
pr fixes
fiqare-emergya-dev Jan 28, 2020
b4a4d73
pr fixed
fiqare-emergya-dev Jan 29, 2020
b6d7148
pr fixed
fiqare-emergya-dev Jan 31, 2020
728e600
travis fixed
fiqare-emergya-dev Feb 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ hs_err_pid*
target
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the PR is close to the end :)

Thus, please add an entry in the CHANGES_NEXT_RELEASE about the changes. The following is the suggested one:

 - Hardening: software quality improvement based on ISO25010 recommendations 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b6d7148

nb-configuration.xml
nbactions.xml

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ install:
- mvn test -B

before_install:
- mvn clean
- mvn clean
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ This is the code repository for the EPL-server, named perseo-core.
* [Architecture](documentation/architecture.md)
* [Logs & Alarms](documentation/logs.md)
* O&M
* [Deployment](documentation/deployment.md)
* [Configuration](documentation/config.md)
* [Administration](documentation/admin.md)
* [Deployment](documentation/deployment.md)
* [Configuration](documentation/config.md)
* [Administration](documentation/admin.md)
* [API](documentation/api.md)

* [License](#licence)
Expand Down
6 changes: 3 additions & 3 deletions documentation/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Being this rule working
@Audit
select *,"blood_1_action" as iotcepaction,
ev.BloodPressure? as Pression,
ev.id? as Meter
ev.id? as Meter
from pattern [
every ev=iotEvent(cast(cast(BloodPressure?,String),float)>1.5
and type="BloodMeter")
]
and type="BloodMeter")
]
```
and sending an event
```JSON
Expand Down
14 changes: 7 additions & 7 deletions documentation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The only dependecy for perseo-core is the servlet engine container for its WAR f

You only need to do this once in your system:

docker build -t perseo .
docker build -t perseo .

The parameter `-t perseo` gives the image a name. This name could be anything, or even include an organization like
`-t org/fiware-perseo`. This name is later used to run the container based on the image.
Expand All @@ -22,12 +22,12 @@ If you want to know more about images and the building process you can find it i
The following line will run the container, using a manually built image (see above),
exposing port `8080`, give it a name -in this case `perseo1`, and present a bash prompt:

docker run -d --name perseo1 -p 8080:8080 perseo
docker run -d --name perseo1 -p 8080:8080 perseo

As a result of this command, there is a PERSEO listening on port 8080 on localhost. Try to see if it works now with

curl localhost:8080/perseo-core/version
curl localhost:8080/perseo-core/version
To get access to the log file of Perseo Core you can run:

```
Expand All @@ -40,7 +40,7 @@ The following line will run the container, from Dockerhub, exposing port `8080`,
and binding it to a [Perseo Front-End](https://github.com/telefonicaid/perseo-fe)
instance (hostname `perseo-frontend`) listening on port 9090.

docker run -d --name perseo_core -h perseocore -p 8080:8080 telefonicaiot/perseo-core:master -perseo_fe_url perseo-frontend:9090
docker run -d --name perseo_core -h perseocore -p 8080:8080 telefonicaiot/perseo-core:master -perseo_fe_url perseo-frontend:9090

A few points to consider:

Expand Down Expand Up @@ -121,5 +121,5 @@ Independently of how the service is installed, the log files will need an extern
Logrotate is installed as RPM dependency along with perseo. The system is configured to rotate every day and whenever the log file size is greater than 100MB (checked very 30 minutes by default):
* For daily rotation: /etc/logrotate.d/logrotate-perseo-daily: which enables daily log rotation
* For size-based rotation:
* /etc/sysconfig/logrotate-perseo-size: in addition to the previous rotation, this file ensures log rotation if the log file grows beyond a given threshold (100 MB by default)
* /etc/cron.d/cron-logrotate-perseo-size: which ensures the execution of etc/sysconfig/logrotate-perseo-size at a regular frecuency (default is 30 minutes)
* /etc/sysconfig/logrotate-perseo-size: in addition to the previous rotation, this file ensures log rotation if the log file grows beyond a given threshold (100 MB by default)
* /etc/cron.d/cron-logrotate-perseo-size: which ensures the execution of etc/sysconfig/logrotate-perseo-size at a regular frecuency (default is 30 minutes)
10 changes: 5 additions & 5 deletions documentation/images/architecture.dot
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
digraph perseocore {
rankdir=LR
rankdir=LR
node [fontname = "arial"];
perseo[shape=circle, style=dashed];
core[label=" core ", shape=circle];
core[label=" core ", shape=circle];

perseo->core[label="rule"]
perseo->core[label="event"]
core->perseo[label="action"]
perseo->core[label="rule"]
perseo->core[label="event"]
core->perseo[label="action"]

}
2 changes: 1 addition & 1 deletion documentation/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Logs have levels `FATAL`, `ERROR`, `INFO` and `DEBUG`. The log level must be set in the configuration file `log4j.xml`

```xml
<priority value="info" />
<priority value="info" />
```

Each log line contains several fields of the form *name*`=` *value*, separated by `|`
Expand Down
10 changes: 10 additions & 0 deletions perseo-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@
<groupId>com.telefonica.iot</groupId>
<version>1.5.0-SNAPSHOT</version>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You explained why org.owasp.encoder dependency is needed at #151 (comment). However, what about org.json? Is this really needed (not sure, but it seem that in the first version of the PR this dependency didn't was included)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We included this dependency because we detected that the package org.json was included directly in the packages of the project. This dependency was outdated and also generated a number of issues (37).
All of them were solved when we added the updated dependency through Maven.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Better to use existing jar files in maven than having the source code of a third-party library in the repository itself.

NTC

<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.ResourceBundle;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seem that after last changes ResourceBunle is no longer used in this file. Thus, this import line should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b6d7148


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -53,7 +55,7 @@ private Configuration() {
private static long maxAge;

static {
LOGGER.debug("Configuration init: " + reload());
LOGGER.debug(String.format("Configuration init: %s",reload()));
}

/**
Expand Down Expand Up @@ -95,21 +97,21 @@ public static synchronized boolean reload() {
// Add actions/do path if perseoFeURLEnv not contains it yet
actionRule = perseoFeURLEnv.contains(actionPath) ? perseoFeURLEnv : perseoFeURLEnv + actionPath;
} else {
LOGGER.error("Invalid value for " + PERSEO_FE_URL_ENV + ": " + perseoFeURLEnv);
LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_FE_URL_ENV, perseoFeURLEnv));
return false;
}
LOGGER.info("actionRule configuration is: " + actionRule);
LOGGER.info(String.format("actionRule configuration is: %s",actionRule));

// Get MAX_AGE from env var if exist, else default
String maxAgeEnv = System.getenv(PERSEO_MAX_AGE_ENV);
// Check maxAge numerical value
try {
maxAge = maxAgeEnv != null ? Long.parseLong(maxAgeEnv) : Long.parseLong(defaultMaxAge);
} catch (NumberFormatException nfe) {
LOGGER.error("Invalid value for " + PERSEO_MAX_AGE_ENV + ": " + nfe);
LOGGER.error(String.format("Invalid value for %s: %s",PERSEO_MAX_AGE_ENV,nfe));
return false;
}
LOGGER.info("maxAge configuration is: " + maxAge);
LOGGER.info(String.format("maxAge configuration is: %s",maxAge));

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author brox
*/
public final class Constants {
private Constants() { };
private Constants() {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 05982ba

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have had a look to 05982ba and it seems perseo-main/src/main/java/com/telefonica/iot/perseo/Constants.java file is not modified in that commit...

The fix seems to be pending.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still pending...

public static final String SERVICE_FIELD = "service";
public static final String SUBSERVICE_FIELD = "subservice";
public static final String CORRELATOR_HEADER = "fiware-correlator";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.log4j.MDC;
import org.json.JSONException;
import org.json.JSONObject;
import org.owasp.encoder.Encode;

/**
*
Expand All @@ -42,7 +43,7 @@
public class EventsServlet extends HttpServlet {

private static final Logger logger = LoggerFactory.getLogger(EventsServlet.class);
EPServiceProvider epService;
private static EPServiceProvider epService;

@Override
public void init() {
Expand Down Expand Up @@ -76,25 +77,25 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
Utils.putCorrelatorAndTrans(request);
logger.debug("events doPost");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=UTF-8");
PrintWriter out = response.getWriter();
response.setContentType("application/json;charset=UTF-8");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indent... again :)

You can self-discover this kind of problems along all the modified files if you have a carefull look to https://github.com/telefonicaid/perseo-core/pull/151/files. Please, do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 47ab836

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis ci fixed in b4a4d73

try {
StringBuilder sb = new StringBuilder();
String eventText = Utils.getBodyAsString(request);
logger.info("incoming event:" + eventText);
logger.info(String.format("incoming event: %s", eventText));
org.json.JSONObject jo = new JSONObject(eventText);
logger.debug("event as JSONObject: " + jo);
logger.debug(String.format("event as JSONObject: %s", jo));
Map<String, Object> eventMap = Utils.JSONObject2Map(jo);
logger.debug("event as map: " + eventMap);
logger.debug(String.format("event as map: %s" , eventMap));
epService.getEPRuntime().sendEvent(eventMap, Constants.IOT_EVENT);
logger.debug("event was sent: " + eventMap);
} catch (JSONException je) {
logger.error("error: " + je);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
out.printf("{\"error\":\"%s\"}\n", je.getMessage());

} finally {
out.close();
logger.debug(String.format("event was sent: %s", eventMap));
} catch (Exception je) {
try {
logger.error(String.format("error: %s" ,je));
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.getOutputStream().print(String.format("{\"error\":\"%s\"}%n", Encode.forHtmlContent(je.getMessage())));
} catch (IOException exception) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public class GenericListener implements UpdateListener {
*/
@Override
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
try {
HashMap<String, JSONObject> rules = TimeRulesStore.getInstance().getAllRulesInfo();
try {
for (EventBean event : newEvents) {

JSONObject jo = Utils.Event2JSONObject(event);
Expand All @@ -64,23 +63,23 @@ public void update(EventBean[] newEvents, EventBean[] oldEvents) {

// Is a timed Rule. Set special headers using rule saved information
Utils.setTimerRuleHeaders(rule);
LOGGER.info("Firing temporal rule: " + event);
LOGGER.info(String.format("Firing temporal rule: %s",event));

} else {

LOGGER.info("Firing Rule: " + event);
LOGGER.info(String.format("Firing Rule: %s",event));
}

LOGGER.debug("result errors: " + jo.optJSONObject("errors"));
LOGGER.debug("result json: " + jo);
LOGGER.debug(String.format("result errors: %s",jo.optJSONObject("errors")));
LOGGER.debug(String.format("result json: %s", jo));

boolean ok = Utils.DoHTTPPost(Configuration.getActionURL(), jo.toString());
if (!ok) {
LOGGER.error("action post failed");
}
}
} catch (PropertyAccessException pae) {
LOGGER.error("doing action " + pae);
LOGGER.error(String.format("doing action %s",pae));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.owasp.encoder.Encode;


/**
Expand Down Expand Up @@ -65,21 +66,28 @@ public class LogLevelServlet extends HttpServlet {
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String levelName = request.getParameter("level");
logger.info("changing log level to " + levelName);
Level level = levels.get(levelName);
if (level == null) {
logger.error("invalid log level: " + levelName);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
try {
String levelName = request.getParameter("level");
logger.info(String.format("changing log level to %s",levelName));
Level level = levels.get(levelName);
if (level == null) {
logger.error(String.format("invalid log level: %s",levelName));
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.getOutputStream().print("{\"errorMessage\":\"invalid log level\"}");
return;
}
synchronized (mutex) {
LogManager.getRootLogger().setLevel(level);
}
response.setStatus(HttpServletResponse.SC_OK);
} catch (IOException e) {
logger.error("IOException in log level");
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.getOutputStream().print("{\"errorMessage\":\"invalid log level\"}");
return;
}
synchronized (mutex) {
LogManager.getRootLogger().setLevel(level);
}
response.setStatus(HttpServletResponse.SC_OK);

}

/**
Expand All @@ -95,11 +103,18 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
logger.debug("getting log level");
synchronized (mutex) {
String currentLevel = LogManager.getRootLogger().getLevel().toString();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_OK);
response.getOutputStream().print("{\"level\":\""+ currentLevel +"\"}");
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 47ab836

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis ci fixed in b4a4d73

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note really fixed... indent is not correct. An extra whitespace before try should be removed:

imagen

String currentLevel = LogManager.getRootLogger().getLevel().toString();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_OK);
response.getOutputStream().print(String.format("{\"level\":\"%s\"}",Encode.forHtmlContent(currentLevel)));
} catch (IOException e) {
logger.error("IOException in log level");
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}

}
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Result {
Result(int code, String msg) {
this.statusCode = code;
this.message = msg;

}

/**
Expand Down
Loading