Skip to content

Commit

Permalink
test(server.py): split log files
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskovalchuk committed Mar 30, 2024
1 parent 18cc447 commit 245bda7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,25 @@ def main():
authorizer.add_user("alice", "password", args.root_directory, perm = "elradfmwM")

handler = None
log_filename = None
if args.use_ssl == 'yes':
handler = TLS_FTPHandler
handler.certfile = os.path.join(sys.path[0], 'pyftpdlib/test/keycert.pem')
handler.tls_control_required = True
handler.tls_data_required = True
log_filename = "ssl_server.log"
else:
handler = FTPHandler
log_filename = "server.log"

handler.authorizer = authorizer
handler.banner = "FTP server is ready."

if os.path.exists("pyftpd.log"):
os.remove("pyftpd.log")
if os.path.exists(log_filename):
os.remove(log_filename)

logging.basicConfig(handlers = [
logging.FileHandler("pyftpd.log"),
logging.FileHandler(log_filename),
logging.StreamHandler()],
level = logging.DEBUG)

Expand Down

0 comments on commit 245bda7

Please sign in to comment.