#13318 closed enhancement (fixed)
Clean up program startup (parameters, logging)
Reported by: | michael2402 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.08 |
Component: | Core | Version: | |
Keywords: | gsoc-core | Cc: | Don-vip, bastiK, stoecker |
Description
I cleaned up the MainApplication
class more.
Things included:
- A new logging class with log level constants
- A new class to parse the command line arguments
- Some cleanup in the initialization tasks
I wrote a new class to log the warning/error messages. The class basically does what main did. But it also traces the source of the log call (as good as the VM allows us to). main is relaying all log calls. So currently you only get messages like (format can be changed):
Aug 11, 2016 3:15:04 PM org.openstreetmap.josm.Main info INFORMATION: Erweiterung 'ImportImagePlugin' wird geladen (Version 32584)
We have two solutions here:
- Ignore the calls from main, use the method that called Main.warn
- Deprecate all
Main
logging methods. This will remove over 200 lines from that class.
I prefer option 2, but it will require a lot of changes to existing source code (but most calls will be search + replace). Stats:
Main.error 325 Main.warn 353 Main.info 109 Main.debug 175 Main.trace 147
There are currently 624 files depending on Main for various reasons. We may reduce that dependency by approx 100 files with this.
Attachments (6)
Change History (25)
by , 8 years ago
Attachment: | patch-main-extract-argument-handling.patch added |
---|
comment:1 by , 8 years ago
by , 8 years ago
Attachment: | patch-fix-13318.patch added |
---|
by , 8 years ago
Attachment: | patch-fix-13318-2.patch added |
---|
comment:4 by , 8 years ago
Thanks for the hint ;-).
I added a new test for the Logging class, 99% coverage (with result checking)
by , 8 years ago
Attachment: | 13318_patch_pb.PNG added |
---|
comment:6 by , 8 years ago
It may have been that the git mirror lacks behind master. I'll have a look at it tomorrow.
comment:7 by , 8 years ago
It's a huge patch to merge manually, can you please help me to get a clean patch?
comment:8 by , 8 years ago
Oh, sorry. I already cleaned it but forgot to attach the patch after travis was through with it.
The newest version is at:
https://github.com/michaelzangl/josm/commit/6eaf0f2bcaf31eaec484228d4989b04645193892
It is 5 days old, so there may already be some comflicts. I'll update the patch to the current JOSM version and then attach it.
by , 8 years ago
Attachment: | patch-fix-13318-4.patch added |
---|
comment:10 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | [Patch] Clean up program startup (parameters, logging) → Clean up program startup (parameters, logging) |
3 unit test failures:
org.openstreetmap.josm.tools.bugreport.BugReportTest.testGetCallingMethod
org.openstreetmap.josm.tools.bugreport.BugReportTest.testIntercept
org.openstreetmap.josm.tools.bugreport.BugReportTest.testReportText
comment:11 by , 8 years ago
Summary: | Clean up program startup (parameters, logging) → [Patch] Clean up program startup (parameters, logging) |
---|
Fix getCallingMethod offset - there is one more call in between now.
Commits:
- 0dfb4e2: Fix getCallingMethod offset - there is one more call in between now.
Stats:
src/org/openstreetmap/josm/tools/bugreport/BugReport.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
by , 8 years ago
Attachment: | patch-fix-13318-tests.patch added |
---|
comment:14 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
r10899 causes this error-prone warning:
[javac] /home/simon/src/josm.svngit/src/org/openstreetmap/josm/tools/Logging.java:69: warning: [UnsynchronizedOverridesSynchronized] Unsynchronized method publish overrides synchronized method in StreamHandler [javac] public void publish(LogRecord record) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized) [javac] Did you mean 'public synchronized void publish(LogRecord record) {'?
comment:15 by , 8 years ago
No. This is a false positive. The parent method is not even synchronized, only the parent of the parent is.
The Idea behind it is, that you do not need to lock the object for the log level check.
comment:16 by , 8 years ago
Summary: | [Patch] Clean up program startup (parameters, logging) → Clean up program startup (parameters, logging) |
---|
comment:18 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I agree it's false positive, let Google fix this one.
Patch does not apply cleanly