Writing to Files

Writing to files is similar to reading from files. Since we are accessing the file system, we must wrap our actions in a try...catch block.

Updated

Working with the FileStream

  1. FileStream Defaults (Journeyman): Writing to a file with a `PrintWriter`, which by default replaces the file or creates a new one.
  2. Appending to a File (Journeyman): How to add lines to the end of a file by opening a `FileOutputStream` in append mode.

Logging Exceptions

  1. Logging Exceptions: an overview (Journeyman): Why applications usually write logs to text files rather than a database, before we build a simple logger.
  2. Creating the LogService (Journeyman): Building a small LogService that appends time-stamped messages to one log file per day.
  3. Writing Log Entries (Journeyman): Using one LogService for error logs and another for application logs, each writing to its own directory.