Skip to content

Commit

Permalink
tools: Add option to frr-reload to specify alternate logfile
Browse files Browse the repository at this point in the history
Adding option --logfile to specify a different logfile instead of
the default /var/log/frr/frr-reload.log

Signed-off-by: Martin Winter <[email protected]>
  • Loading branch information
mwinter-osr committed Mar 4, 2024
1 parent 9feb1aa commit 0ed9927
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/frr-reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,11 @@ def compare_context_objects(newconf, running):
help="Used by topotest to not delete debug or log file commands",
)

parser.add_argument(
"--logfile", help="logfile for frr-reload",
default="/var/log/frr/frr-reload.log"
)

args = parser.parse_args()

# Logging
Expand All @@ -1921,11 +1926,11 @@ def compare_context_objects(newconf, running):
)

elif args.reload:
if not os.path.isdir("/var/log/frr/"):
os.makedirs("/var/log/frr/", mode=0o0755)
if not os.path.isdir(os.path.dirname(args.logfile)):
os.makedirs(os.path.dirname(args.logfile), mode=0o0755)

logging.basicConfig(
filename="/var/log/frr/frr-reload.log",
filename=args.logfile,
format="%(asctime)s %(levelname)5s: %(message)s",
)

Expand Down

0 comments on commit 0ed9927

Please sign in to comment.