mirror of
https://github.com/corda/corda.git
synced 2024-12-21 22:07:55 +00:00
CORDA-2862: Fix to allow softlinks of logs directory (#5034)
This commit is contained in:
parent
f723f8c768
commit
87fe7b4d88
@ -38,6 +38,7 @@ import java.io.RandomAccessFile
|
|||||||
import java.lang.management.ManagementFactory
|
import java.lang.management.ManagementFactory
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.nio.channels.UnresolvedAddressException
|
import java.nio.channels.UnresolvedAddressException
|
||||||
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.time.DayOfWeek
|
import java.time.DayOfWeek
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
@ -486,7 +487,11 @@ fun CliWrapperBase.initLogging(baseDirectory: Path): Boolean {
|
|||||||
//Test for access to the logging path and shutdown if we are unable to reach it.
|
//Test for access to the logging path and shutdown if we are unable to reach it.
|
||||||
val logPath = baseDirectory / NodeCliCommand.LOGS_DIRECTORY_NAME
|
val logPath = baseDirectory / NodeCliCommand.LOGS_DIRECTORY_NAME
|
||||||
try {
|
try {
|
||||||
logPath.createDirectories()
|
if (Files.isSymbolicLink(logPath)){
|
||||||
|
Files.readSymbolicLink(logPath).createDirectories()
|
||||||
|
} else {
|
||||||
|
logPath.createDirectories()
|
||||||
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
printError("Unable to create logging directory ${logPath.toString()}. Node will now shutdown.")
|
printError("Unable to create logging directory ${logPath.toString()}. Node will now shutdown.")
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user