ho-dev / HattrickOrganizer

Assistant for Hattrick online football manager
https://ho-dev.github.io/HattrickOrganizer/
GNU Lesser General Public License v3.0
194 stars 79 forks source link

[BUG] HO 4.0: Exception at start on Linux #622

Closed yaute74 closed 4 years ago

yaute74 commented 4 years ago

Describe the bug Exception at start on linux

To Reproduce Start HO:

java.io.FileNotFoundException: log file directory '/opt/HO/null/HO' doesn't exist.
    at com.exe4j.runtime.LauncherEngine.checkRedirectionFile(LauncherEngine.java:184)
    at com.exe4j.runtime.LauncherEngine.doRedirection(LauncherEngine.java:160)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:59)
    at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:66)
    at install4j.core.HOLauncher2669317107.main(Unknown Source)
Jun 26, 2020 8:59:37 PM org.hsqldb.persist.Logger logInfoEvent
INFO: dataFileCache open start
Jun 26, 2020 8:59:37 PM org.hsqldb.persist.Logger logInfoEvent
INFO: dataFileCache open end
Unable to create logfile: logs/HO-2020-06-26.log
java.lang.NullPointerException
    at core.util.HOLogger.deleteOldLogs(HOLogger.java:58)
    at core.util.HOLogger.<init>(HOLogger.java:38)
    at core.util.HOLogger.instance(HOLogger.java:68)
    at core.db.DBUpdater.updateDB(DBUpdater.java:37)
    at core.db.DBManager.instance(DBManager.java:194)
    at core.HO.main(HO.java:150)
    at core.HOLauncher.main(HOLauncher.java:31)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
    at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:66)
    at install4j.core.HOLauncher2669317107.main(Unknown Source)

Platform information:

akasolace commented 4 years ago

linked to #591

akasolace commented 4 years ago

I just tried in Ubunu with the latest 4.0 version .... and I can't reproduce the error you described but still something is off clearly:

image

@DavidatorusF can you confirm this is also what you got ?

@yaute74 can you test again ? it is strange it does not behave the same in arch and in debian .... the post install script is supposed to give writting right to /opt/HO ...

@tychobrailleur @yaute74 @wsbrenk should we remove logs folder as it is now duplicated information of error.log and output.log ?

tychobrailleur commented 4 years ago

@tychobrailleur @yaute74 @wsbrenk should we remove logs folder as it is now duplicated information of error.log and output.log ?

I don't believe error.log / output.log are duplicates of what is under logs/, I think they are log files generated during installation, whereas logs under logs/ are created by HO logger.

I'd put the logs in the one place (logs/) as they tend to accumulate after a while.

akasolace commented 4 years ago

I don't believe error.log / output.log are duplicates of what is under logs/, I think they are log files generated during installation, whereas logs under logs/ are created by HO logger.

is it the case under macOS? Under Windows it seems they capture all that would be printed hence they capture all information from HOLogger ....

akasolace commented 4 years ago

@tychobrailleur I want to treat this one, but I have a doubt for macOS at the moment the error.log file should be created in ${installer:sys.appdataDir}\HO\error.log not sure if this is the right place, is it at the same level as the db ? If it is, I could simply replace it with ${installer:sys.appdataDir}\HO\logs\error.log

akasolace commented 4 years ago

@yaute74 @DavidatorusF @tychobrailleur @wsbrenk could you test if it is fixed in latest artefacts (4.0.0.3010) the aim is to have all logs in a logs folder at the same level as the db folder. Hence it is specific to instalation type (zip/install) and platform (win/linux/macOS). I will submit PR based if I got positive feedback.

yaute74 commented 4 years ago

@akasolace I do a test with the install 4.0.0.3010. I always have an exception at start:

java.io.FileNotFoundException: log file directory '/opt/HO/null/HO/logs' doesn't exist.                                                                                                                            
        at com.exe4j.runtime.LauncherEngine.checkRedirectionFile(LauncherEngine.java:184)
        at com.exe4j.runtime.LauncherEngine.doRedirection(LauncherEngine.java:160)
        at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:59)
        at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:66)
        at install4j.core.HOLauncher2669317107.main(Unknown Source)
Jul 16, 2020 8:19:30 PM org.hsqldb.persist.Logger logInfoEvent

But I have a log in ~/.ho/logs

akasolace commented 4 years ago

@yaute74 ok I will work a bit more then...

akasolace commented 4 years ago

this is linked to #591

akasolace commented 4 years ago

@yaute74 ok I think version 3013 is fine if you can confirm it (I made test in my VM). @tychobrailleur can you please it also good for macOS then I will do the PR that closes both #622 and #591

tychobrailleur commented 4 years ago

@tychobrailleur can you please it also good for macOS

Sure:

~/Library/Application Support/HO 🔰‏ tree
.
├── db
│   ├── database.data
│   ├── database.lck
│   ├── database.log
│   ├── database.properties
│   ├── database.script
│   └── database.tmp
├── logs
│   ├── HO-2020-07-17.log
│   ├── error.log
│   └── output.log
└── users.json

3 directories, 9 files

👍

yaute74 commented 4 years ago

@akasolace it's ok now, no more exception, good job :+1: I have two logs in ~/.ho HO-2020-07-23.log and error.log

akasolace commented 4 years ago

ok perfect ... HO-2020-07-23.log is the historical log, the other one is the redirected stderr