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

#579 Update to log4j 2.17.1 #163

Merged
merged 3 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All changes on the master branch are deployed automatically to the corresponding
- `org.eclipse.glsp.graph`: EMF-based implementation of graphical model that's used for client-server communication
- `org.eclipse.glsp.layout`: Server-based layout using the [Eclipse Layout Kernel](https://www.eclipse.org/elk/) framework (adapted from [Eclipse Sprotty Server](https://www.github.com/eclipse/sprotty-server))
- `org.eclipse.glsp.server`: Generic base implementation for standalone GLSP servers (based on JSON-RPC)
- `org.eclipse.glsp.server.emf`: Reusable implementations if an [EMF](https://www.eclipse.org/modeling/emf/)-based source model is used
- `org.eclipse.glsp.server.websocket`: Extension of the base server implementation for communication over websockets

- `org.eclipse.glsp.example.workflow`: GLSP server for the Workflow Diagram example
Expand All @@ -52,15 +53,38 @@ In the root of this repository, run
mvn clean verify -Pm2 -Pfatjar
```

### Execute from IDE

To run the Workflow Diagram example server within an IDE, run the main method of
[`WorkflowServerLauncher.java`](./examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/launch/WorkflowServerLauncher.java) as a Java Application, located in the module `glsp-server/examples/org.eclipse.glsp.example.workflow.launch`.

### Execute Standalone JAR

In the folder `examples/org.eclipse.glsp.example.workflow/target`, you should have a jar file `org.eclipse.glsp.example.workflow-X.X.X-SNAPSHOT-glsp.jar` whereas `X.X.X` is the current version.
You can now start the server by executing the following commands:

```bash
cd examples/org.eclipse.glsp.example.workflow/target
java -jar org.eclipse.glsp.example.workflow-X.X.X-SNAPSHOT-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher
To run the Workflow Diagram example server standalone JAR, run this command in your terminal:

```console
cd examples/org.eclipse.glsp.example.workflow/target
java -jar org.eclipse.glsp.example.workflow-X.X.X-SNAPSHOT-glsp.jar
```

To start the example server from within your IDE, run the main method of the class [ExampleServerLauncher.java](https://github.com/eclipse-glsp/glsp-server/blob/master/examples/org.eclipse.glsp.example.workflow/src/org/eclipse/glsp/example/workflow/launch/WorkflowServerLauncher.java) in the module `glsp-server/examples/org.eclipse.glsp.example.workflow`.
#### Usage

```console
usage: java -jar org.eclipse.glsp.example.workflow-X.X.X-glsp.jar [-c <arg>] [-d <arg>]
[-f <arg>] [-h] [-l <arg>] [-p <arg>] [-w]

options:
-c,--consoleLog <arg> Enable/Disable console logging. [default='true']
-d,--logDir <arg> Set the directory for log files (File logging has to be enabled)
-f,--fileLog <arg> Enable/Disable file logging. [default='false']
-h,--help Display usage information about GLSPServerLauncher
-l,--logLevel <arg> Set the log level. [default='INFO']
-p,--port <arg> Set server port. [default='5007']
-w,--websocket Use websocket launcher instead of default launcher.
[default='false']
```

Once the server is running, choose a diagram client integration (such as Eclipse Theia, VSCode, Eclipse, or Standalone) below.

Expand Down
3 changes: 2 additions & 1 deletion examples/org.eclipse.glsp.example.workflow/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/bin/
/bin/
/logs/
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Require-Bundle: org.eclipse.glsp.layout;bundle-version="[0.10.0,1.0.0)",
org.eclipse.elk.core;bundle-version="0.6.0",
org.eclipse.elk.alg.layered;bundle-version="0.6.0",
org.eclipse.elk.graph;bundle-version="0.6.0"
Import-Package: org.apache.log4j;version="1.2.15"
Import-Package: org.apache.logging.log4j;version="2.17.1"
4 changes: 4 additions & 0 deletions examples/org.eclipse.glsp.example.workflow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.eclipse.glsp.example.workflow.launch.WorkflowServerLauncher</mainClass>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
</transformers>
<artifactSet>
Expand All @@ -159,6 +162,7 @@
<exclude>META-INF/ECLIPSE_*</exclude>
<exclude>META-INF/LICENSE*</exclude>
<exclude>META-INF/services/javax.servlet.ServletContainerInitializer*</exclude>
<exclude>META-INF/services/org.eclipse.elk.core.data.ILayoutMetaDataProvider*</exclude>
<exclude>META-INF/NOTICE*</exclude>
<exclude>.options</exclude>
<exclude>.api_description</exclude>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2019-2021 EclipseSource and others.
* Copyright (c) 2019-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -20,13 +20,14 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.glsp.server.protocol.DefaultGLSPServer;
import org.eclipse.glsp.server.protocol.InitializeResult;
import org.eclipse.glsp.server.utils.MapUtil;

public class WorkflowGLSPServer extends DefaultGLSPServer {
private static final Logger LOGGER = Logger.getLogger(WorkflowGLSPServer.class);
private static final Logger LOGGER = LogManager.getLogger(WorkflowGLSPServer.class);
private static final String MESSAGE_KEY = "message";
private static final String TIMESTAMP_KEY = "timestamp";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2020-2021 EclipseSource and others.
* Copyright (c) 2020-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -18,19 +18,20 @@
import java.util.Collections;
import java.util.List;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.glsp.example.workflow.action.LogAction;
import org.eclipse.glsp.server.actions.Action;
import org.eclipse.glsp.server.actions.AbstractActionHandler;
import org.eclipse.glsp.server.actions.Action;
import org.eclipse.glsp.server.types.Severity;

public class LogActionHandler extends AbstractActionHandler<LogAction> {
private static Logger LOG = Logger.getLogger(LogActionHandler.class);
private static Logger LOGGER = LogManager.getLogger(LogActionHandler.class);

@Override
protected List<Action> executeAction(final LogAction action) {
LOG.log(toLevel(action.getSeverity()), action.getMessage());
LOGGER.log(toLevel(action.getSeverity()), action.getMessage());
return Collections.emptyList();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2020 EclipseSource and others.
* Copyright (c) 2020-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -31,7 +31,7 @@ public WorkflowCLIParser(final String[] args, final String processName)

public static Options getDefaultOptions() {
Options options = DefaultCLIParser.getDefaultOptions();
options.addOption(null, OPTION_WEBSOCKET, false,
options.addOption("w", OPTION_WEBSOCKET, false,
"Use websocket launcher instead of default launcher. [default='false']");
return options;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2019-2021 EclipseSource and others.
* Copyright (c) 2019-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -15,15 +15,13 @@
********************************************************************************/
package org.eclipse.glsp.example.workflow.launch;

import java.io.IOException;

import org.apache.commons.cli.ParseException;
import org.eclipse.elk.alg.layered.options.LayeredMetaDataProvider;
import org.eclipse.glsp.example.workflow.WorkflowDiagramModule;
import org.eclipse.glsp.layout.ElkLayoutEngine;
import org.eclipse.glsp.server.di.ServerModule;
import org.eclipse.glsp.server.launch.SocketGLSPServerLauncher;
import org.eclipse.glsp.server.launch.GLSPServerLauncher;
import org.eclipse.glsp.server.launch.SocketGLSPServerLauncher;
import org.eclipse.glsp.server.utils.LaunchUtil;
import org.eclipse.glsp.server.websocket.WebsocketServerLauncher;

Expand All @@ -32,10 +30,9 @@ private WorkflowServerLauncher() {}

@SuppressWarnings("uncommentedmain")
public static void main(final String[] args) {
String processName = "WorkflowExampleGlspServer";
String processName = "org.eclipse.glsp.example.workflow-X.X.X-glsp.jar";
try {
WorkflowCLIParser parser = new WorkflowCLIParser(args, processName);
LaunchUtil.configure(parser);
ElkLayoutEngine.initialize(new LayeredMetaDataProvider());

int port = parser.parsePort();
Expand All @@ -46,9 +43,9 @@ public static void main(final String[] args) {
? new WebsocketServerLauncher(workflowServerModule, "/workflow")
: new SocketGLSPServerLauncher(workflowServerModule);

launcher.start("localhost", port);
launcher.start("localhost", port, parser);

} catch (ParseException | IOException ex) {
} catch (ParseException ex) {
ex.printStackTrace();
System.out.println();
LaunchUtil.printHelp(processName, WorkflowCLIParser.getDefaultOptions());
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.glsp.graph/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Export-Package: org.eclipse.glsp.graph,
org.eclipse.glsp.graph.impl,
org.eclipse.glsp.graph.util,
org.eclipse.glsp.graph.util
Import-Package: org.apache.log4j;version="1.2.15"
Import-Package: org.apache.logging.log4j;version="2.17.1"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2019 EclipseSource and others.
* Copyright (c) 2019-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -25,7 +25,8 @@
import java.util.Optional;
import java.util.Set;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
Expand All @@ -43,7 +44,7 @@

public class GModelElementTypeAdapter extends PropertyBasedTypeAdapter<GModelElement> {

private static final Logger LOG = Logger.getLogger(GModelElementTypeAdapter.class);
private static final Logger LOGGER = LogManager.getLogger(GModelElementTypeAdapter.class);

private final Gson gson;
private final Map<String, EClass> typeMap;
Expand Down Expand Up @@ -84,7 +85,7 @@ protected GModelElement createInstance(final String type) {
element.setType(type);
return element;
}
LOG.error("Cannot find class for type " + type);
LOGGER.error("Cannot find class for type " + type);
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/org.eclipse.glsp.server.emf/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Require-Bundle: org.eclipse.glsp.server;bundle-version="0.10.0",
org.eclipse.glsp.graph;bundle-version="0.10.0",
org.eclipse.emf.ecore;bundle-version="2.23.0",
org.eclipse.emf.ecore.edit;bundle-version="2.13.0",
org.eclipse.emf.ecore.xmi;bundle-version="2.16.0",
org.apache.log4j;bundle-version="1.2.15"
org.eclipse.emf.ecore.xmi;bundle-version="2.16.0"
Export-Package:
org.eclipse.glsp.server.emf,
org.eclipse.glsp.server.emf.model.notation,
org.eclipse.glsp.server.emf.model.notation.impl,
org.eclipse.glsp.server.emf.model.notation.util,
org.eclipse.glsp.server.emf.notation,
org.eclipse.glsp.server.emf.notation.util
Import-Package: org.apache.logging.log4j;version="2.17.1"

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
********************************************************************************/
package org.eclipse.glsp.server.emf;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.resource.Resource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.Collections;
import java.util.Optional;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import java.util.List;
import java.util.Optional;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.glsp.graph.GModelElement;
import org.eclipse.glsp.graph.util.RootAdapterUtil;
Expand All @@ -38,7 +39,7 @@
* Offers a set of query methods retrieve, initialize and resolve indexed notation elements.
*/
public class EMFNotationModelIndex extends EMFModelIndex {
protected static Logger LOGGER = Logger.getLogger(EMFNotationModelIndex.class);
protected static Logger LOGGER = LogManager.getLogger(EMFNotationModelIndex.class);

protected BiMap<EObject, NotationElement> notationIndex;
protected final EMFSemanticIdConverter idConverter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ Require-Bundle: javax.websocket;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.lsp4j.jsonrpc
Export-Package: org.eclipse.glsp.server.websocket
Import-Package: javax.servlet;version="[3.1.0,4.0.0)",
org.apache.log4j;version="1.2.15"
org.apache.logging.log4j;version="2.17.1",
org.apache.logging.log4j.spi;version="2.17.1"
Loading