replace syso with logger
* replacing all debug/info syso and all syse with log4j 2 logger
This commit is contained in:
parent
dec767f553
commit
71cf0316ec
|
@ -23,5 +23,7 @@
|
||||||
<classpathentry kind="lib" path="src/libraries/jfoenix-1.7.0.jar"/>
|
<classpathentry kind="lib" path="src/libraries/jfoenix-1.7.0.jar"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.19.3.jar"/>
|
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.19.3.jar"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/zip4j-1.3.2.jar"/>
|
<classpathentry kind="lib" path="src/libraries/zip4j-1.3.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="src/libraries/log4j-api-2.8.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="src/libraries/log4j-core-2.8.2.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
/application/
|
/application/
|
||||||
/datatypes/
|
/resources/
|
||||||
/libraries/
|
/log4j2.xml
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -21,6 +21,8 @@ import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
|
@ -48,7 +50,7 @@ public class Main extends Application {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private File localDB;
|
private File localDB;
|
||||||
private File pictureCache;
|
private File pictureCache;
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(Main.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
|
@ -88,7 +90,8 @@ public class Main extends Application {
|
||||||
//startup checks
|
//startup checks
|
||||||
//check if client_secret.jason is present
|
//check if client_secret.jason is present
|
||||||
if (Main.class.getResourceAsStream("/resources/client_secret.json") == null) {
|
if (Main.class.getResourceAsStream("/resources/client_secret.json") == null) {
|
||||||
System.err.println("client_secret is missing!!!!!");
|
LOGGER.error("client_secret is missing!!!!!");
|
||||||
|
// System.err.println("client_secret is missing!!!!!");
|
||||||
|
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("cemu_UI");
|
alert.setTitle("cemu_UI");
|
||||||
|
@ -97,22 +100,26 @@ public class Main extends Application {
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Directory: " + directory.exists());
|
LOGGER.info("Directory: " + directory.exists());
|
||||||
System.out.println("configfile: " + configFile.exists());
|
LOGGER.info("Configfile: " + configFile.exists());
|
||||||
if(directory.exists() != true){
|
// System.out.println("Directory: " + directory.exists());
|
||||||
System.out.println("mkdir all");
|
// System.out.println("configfile: " + configFile.exists());
|
||||||
|
if(!directory.exists()){
|
||||||
|
LOGGER.info("creating cemu_UI directory");
|
||||||
|
// System.out.println("mkdir all");
|
||||||
directory.mkdir();
|
directory.mkdir();
|
||||||
pictureCache.mkdir();
|
pictureCache.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(configFile.exists() != true){
|
if(!configFile.exists()){
|
||||||
System.out.println("firststart");
|
LOGGER.info("firststart, setting default values");
|
||||||
|
// System.out.println("firststart");
|
||||||
firstStart();
|
firstStart();
|
||||||
mainWindowController.setColor("00a8cc");
|
mainWindowController.setColor("00a8cc");
|
||||||
mainWindowController.setxPosHelper(0);
|
mainWindowController.setxPosHelper(0);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.saveSettings();
|
||||||
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itselfdownloading games.db...
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pictureCache.exists() != true){
|
if(pictureCache.exists() != true){
|
||||||
|
@ -121,13 +128,15 @@ public class Main extends Application {
|
||||||
|
|
||||||
if(gamesDBFile.exists() != true){
|
if(gamesDBFile.exists() != true){
|
||||||
try {
|
try {
|
||||||
System.out.print("downloading games.db... ");
|
LOGGER.info("downloading games.db... ");
|
||||||
|
// System.out.print("downloading games.db... ");
|
||||||
URL website = new URL(gamesDBdownloadURL);
|
URL website = new URL(gamesDBdownloadURL);
|
||||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
|
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
|
||||||
FileOutputStream fos = new FileOutputStream(gamesDBFile);
|
FileOutputStream fos = new FileOutputStream(gamesDBFile);
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||||
fos.close();
|
fos.close();
|
||||||
System.out.println("done!");
|
LOGGER.info("finished downloading games.db");
|
||||||
|
// System.out.println("done!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ import javax.swing.ProgressMonitor;
|
||||||
import javax.swing.ProgressMonitorInputStream;
|
import javax.swing.ProgressMonitorInputStream;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXColorPicker;
|
import com.jfoenix.controls.JFXColorPicker;
|
||||||
|
@ -211,19 +213,19 @@ public class MainWindowController {
|
||||||
private String cemuPath;
|
private String cemuPath;
|
||||||
private String romPath;
|
private String romPath;
|
||||||
private String gameExecutePath;
|
private String gameExecutePath;
|
||||||
private String selectedGameTitleID;
|
|
||||||
private String selectedGameTitle;
|
|
||||||
private String color;
|
private String color;
|
||||||
private String dialogBtnStyle;
|
private String dialogBtnStyle;
|
||||||
|
private String selectedGameTitleID;
|
||||||
|
private String selectedGameTitle;
|
||||||
|
private String id;
|
||||||
private String version = "0.1.6";
|
private String version = "0.1.6";
|
||||||
private String buildNumber = "035";
|
private String buildNumber = "037";
|
||||||
private String versionName = "Throwback Galaxy";
|
private String versionName = "Throwback Galaxy";
|
||||||
private int xPos = -200;
|
private int xPos = -200;
|
||||||
private int yPos = 17;
|
private int yPos = 17;
|
||||||
private int xPosHelper;
|
private int xPosHelper;
|
||||||
private int selectedUIDataIndex;
|
private int selectedUIDataIndex;
|
||||||
private int selected;
|
private int selected;
|
||||||
private String id;
|
|
||||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI");
|
private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI");
|
||||||
private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI");
|
private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI");
|
||||||
|
@ -238,6 +240,7 @@ public class MainWindowController {
|
||||||
ArrayList<Text> nameText = new ArrayList<Text>();
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
Properties gameProps = new Properties();
|
Properties gameProps = new Properties();
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
||||||
private MenuItem edit = new MenuItem("edit");
|
private MenuItem edit = new MenuItem("edit");
|
||||||
private MenuItem remove = new MenuItem("remove");
|
private MenuItem remove = new MenuItem("remove");
|
||||||
private MenuItem update = new MenuItem("update");
|
private MenuItem update = new MenuItem("update");
|
||||||
|
@ -297,7 +300,8 @@ public class MainWindowController {
|
||||||
* initialize all actions not initialized by a own method
|
* initialize all actions not initialized by a own method
|
||||||
*/
|
*/
|
||||||
void initActions() {
|
void initActions() {
|
||||||
System.out.println("initializing Actions... ");
|
LOGGER.info("initializing Actions... ");
|
||||||
|
// System.out.println("initializing Actions... ");
|
||||||
|
|
||||||
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
|
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
|
||||||
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
|
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
|
||||||
|
@ -568,8 +572,8 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
LOGGER.info("initializing Actions done!");
|
||||||
System.out.println("initializing Actions done!");
|
// System.out.println("initializing Actions done!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -1264,7 +1268,8 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSettings(){
|
void saveSettings(){
|
||||||
System.out.print("saving Settings... ");
|
LOGGER.info("saving Settings...");
|
||||||
|
// System.out.print("saving Settings... ");
|
||||||
OutputStream outputStream; //new output-stream
|
OutputStream outputStream; //new output-stream
|
||||||
try {
|
try {
|
||||||
props.setProperty("cemuPath", getCemuPath());
|
props.setProperty("cemuPath", getCemuPath());
|
||||||
|
@ -1285,14 +1290,17 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml
|
props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
System.out.println("done!");
|
LOGGER.info("saving Settings done!");
|
||||||
|
// System.out.println("done!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.error("an error occured", e);
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSettings(){
|
void loadSettings(){
|
||||||
System.out.print("loading settings... ");
|
LOGGER.info("loading settings...");
|
||||||
|
// System.out.print("loading settings... ");
|
||||||
InputStream inputStream;
|
InputStream inputStream;
|
||||||
try {
|
try {
|
||||||
if(System.getProperty("os.name").equals("Linux")){
|
if(System.getProperty("os.name").equals("Linux")){
|
||||||
|
@ -1309,9 +1317,11 @@ public class MainWindowController {
|
||||||
setCloudService(props.getProperty("cloudService"));
|
setCloudService(props.getProperty("cloudService"));
|
||||||
main.cloudController.setFolderID(props.getProperty("folderID"), getCloudService());
|
main.cloudController.setFolderID(props.getProperty("folderID"), getCloudService());
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
System.out.println("done!");
|
LOGGER.info("loading settings done!");
|
||||||
|
// System.out.println("done!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.error("an error occured", e);
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="WARN">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="INFO">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
Loading…
Reference in New Issue