Skip to content

Commit 37ee075

Browse files
committed
Change supervisor to use FileHandler for logging
1 parent a26194b commit 37ee075

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/kotlin/supervisor/CarpoolSupervisorMain.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import java.rmi.registry.LocateRegistry
88
import java.util.logging.FileHandler
99
import java.util.logging.Level
1010
import java.util.logging.Logger
11+
import java.util.logging.SimpleFormatter
1112
import kotlin.io.path.Path
1213
import kotlin.system.exitProcess
1314

@@ -43,10 +44,13 @@ fun main(args: Array<String>) {
4344
val pid = ProcessHandle.current().pid()
4445
val port = args.getRequired<Int>("port")
4546

47+
val logFileHandler = FileHandler(
48+
args.getRequired<Path>("log_dir").resolve("supervisor-log.txt").toString(),
49+
)
50+
logFileHandler.formatter = SimpleFormatter()
51+
4652
LOGGER.useParentHandlers = false
47-
LOGGER.addHandler(FileHandler(
48-
args.getRequired<Path>("log_dir").resolve("supervisor-log.txt").toString()
49-
))
53+
LOGGER.addHandler(logFileHandler)
5054
LOGGER.level = args.getRequired<Level>("log_level")
5155
LOGGER.info { "Starting supervisor daemon -- PID $pid" }
5256

0 commit comments

Comments
 (0)