Error Logging - rsanchez-wsu/jfiles GitHub Wiki
I was thinking that we (or atleast someone involved with the project) should write code to dump error messages into a log file. At first it will be able to do little more than record error messages but as we refine the project, we can update it to capture information about the state of the project at run time when something goes wrong and we can use it as a major debugging tool.
Log4J
-
Can create "Key Events" to be fired with custom levels
-
Example includes firing an event labeled "WARN" when a user incorrectly enters a passcode
-
Can control when logging is on or off
-
Each connection should be assigned a PID by the server. These PIDs should then be included in each error message that is generated for that session. This allows us to track issues when there are multiple sessions logging at once.
Categories:
FATAL:
127.0.0.1 FATAL: "Server could not start"
127.0.0.1 FATAL: "Server unexpectedly shut down"ERROR:
127.0.0.1 ERROR: "Client sent following string that could not be parsed: 'File01_$$^!.txt'
127.0.0.1 ERROR: "Server lost connection to client."
127.0.0.1 ERROR: "Cannot locate requested resource"
WARN:
127.0.0.1 WARN: "User incorrectly entered password"
127.0.0.1 WARN: "Slow access time to client"
127.0.0.1 WARN: "File system capacity reached"
INFO:
127.0.0.1 INFO: "Server started"
DEBUG:
127.0.0.1 DEBUG: "Server started on port 8080"
127.0.0.1 DEBUG: "Server established connected to 192.168.1.4:8080"
127.0.0.1 DEBUG: "Server received data from client"
127.0.0.1 DEBUG: "Something went wrong. Lost connection to client."
127.0.0.1 DEBUG: "Session ended."