triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.35k stars 399 forks source link

Migrate to SLF4J? #7090

Open DanVanAtta opened 4 years ago

DanVanAtta commented 4 years ago

Suggestion, migrate from java.util.Log to SLF4J

Benefits:

1. Better API

Instead of:

log.log(Level.WARNING, "message", e);

Can have:

log.warning("message", e);

2. Cleaner log levels

There is no 'fine', 'finer', 'finest', that is just dispensed with

3. Built in String.format

SLF4J has built-in wildcard replacements.

Instead of:

log.info(String.format("message %s", variable));

Can do:

log.info("message {}", variable);

4. Unified logging (consistency)

HttpServer is using SLF4J, the rest of the code is not. Decoupling dropwizard from SLF4J would be painful. If we migrate it all to SLF4J then we'd have just the one logging framework.


I'm proposing this now as it's a good time to do so. If we migrate all of the logging via bulk changes, we can also see about converting messages from error to warning to remove the error reporting for user-induced errors. This is a migration I've wanted to do for quite some time.

asvitkine commented 4 years ago

SGTM

RoiEXLab commented 4 years ago

I don't have any strong preferences, but I'd agree that the SLF4J API is nicer

bacrossland commented 4 years ago

I support your move to SLF4J. I noticed that you are using Lombok which will make the conversion to SLF4J easier since it has an annotation that creates the log object for you.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. If there is something that can be done to resolve this issue, please add a comment indicating what that would be and this issue will be re-opened. If there are multiple items that can be completed independently, we encourage you to use the "reference in new issue" option next to any outstanding comment so that we may divide and conquer.