rolandweber / Pityoulish

A collection of programming/debugging exercises to support a course on Distributed Systems.
Creative Commons Zero v1.0 Universal
7 stars 0 forks source link

Use Java Logging to write a server log file #21

Closed rolandweber closed 7 years ago

rolandweber commented 8 years ago

Employ java.util.logging across the Message Board code.

Exceptions should be logged where they are thrown (or created), not where they are caught.

On the server, direct most log output into a file, to keep the console clean. It's not helpful for the classroom exercise to see stack traces of ProtocolException there.

Don't use class names as logger names on the server. It would interfere with obfuscation (#25).

implemented:

The servers and FtB clients for Sockets and Java RMI are now enabled for logging. Call java with -Dpityoulish.log=file to generate a log file in the current directory. Call it with -Dpityoulish.log= to enable standard Java log settings, level INFO or higher to the console. If the property is not set, the programs assume -Dpityoulish.log=silent and will log only level SEVERE to the console. Exceptions from invalid requests are logged at level WARNING and will therefore not be printed by default.

rolandweber commented 7 years ago

If logging is extended to utility classes, like the TLV helpers, it needs to be considered on the client side as well.

rolandweber commented 7 years ago

The long-running programs, servers and FtB clients, have configurable logging now. I've omitted the clients yet, because they'll require changes to the exercise descriptions and JavaDocs when a new package is added to the JAR.

The servers and FtB clients should log a welcome message, so that the log file is created on startup when the file config is selected.