mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 01:36:32 +01:00
Combining log files does not actually work, removing functionality
This commit is contained in:
parent
1befcb1699
commit
6e5f9e8d2e
4 changed files with 35 additions and 19 deletions
|
|
@ -811,7 +811,13 @@ def start_evennia(pprofiler=False, sprofiler=False):
|
|||
def _portal_not_running(fail):
|
||||
print("Portal starting {}...".format("(under cProfile)" if pprofiler else ""))
|
||||
try:
|
||||
Popen(portal_cmd, env=getenv(), bufsize=-1)
|
||||
if os.name == 'nt':
|
||||
# Windows requires special care
|
||||
create_no_window = 0x08000000
|
||||
Popen(portal_cmd, env=getenv(), bufsize=-1,
|
||||
createflags=create_no_window)
|
||||
else:
|
||||
Popen(portal_cmd, env=getenv(), bufsize=-1)
|
||||
except Exception as e:
|
||||
print(PROCESS_ERROR.format(component="Portal", traceback=e))
|
||||
_reactor_stop()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import os
|
|||
import sys
|
||||
from twisted.internet import protocol
|
||||
from evennia.server.portal import amp
|
||||
from django.conf import settings
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
from evennia.utils import logger
|
||||
|
||||
|
|
@ -150,21 +151,32 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
|
|||
|
||||
"""
|
||||
# start the Server
|
||||
try:
|
||||
process = Popen(server_twistd_cmd, env=getenv(), bufsize=-1, stdout=PIPE, stderr=STDOUT)
|
||||
except Exception:
|
||||
self.factory.portal.server_process_id = None
|
||||
logger.log_trace()
|
||||
return 0
|
||||
# there is a short window before the server logger is up where we must
|
||||
# catch the stdout of the Server or eventual tracebacks will be lost.
|
||||
with process.stdout as out:
|
||||
logger.log_server(out.read())
|
||||
with open(settings.SERVER_LOG_FILE, 'a') as logfile:
|
||||
try:
|
||||
if os.name == 'nt':
|
||||
# Windows requires special care
|
||||
create_no_window = 0x08000000
|
||||
process = Popen(server_twistd_cmd, env=getenv(), bufsize=-1,
|
||||
stdout=logfile, stderr=STDOUT,
|
||||
creationflags=create_no_window)
|
||||
else:
|
||||
process = Popen(server_twistd_cmd, env=getenv(), bufsize=-1,
|
||||
stdout=logfile, stderr=STDOUT)
|
||||
except Exception:
|
||||
self.factory.portal.server_process_id = None
|
||||
logger.log_trace()
|
||||
logfile.flush()
|
||||
return 0
|
||||
# there is a short window before the server logger is up where we must
|
||||
# catch the stdout of the Server or eventual tracebacks will be lost.
|
||||
# with process.stdout as out:
|
||||
# logger.log_server(out.readlines())
|
||||
|
||||
# store the pid and launch argument for future reference
|
||||
self.factory.portal.server_process_id = process.pid
|
||||
self.factory.portal.server_twistd_cmd = server_twistd_cmd
|
||||
return process.pid
|
||||
# store the pid and launch argument for future reference
|
||||
self.factory.portal.server_process_id = process.pid
|
||||
self.factory.portal.server_twistd_cmd = server_twistd_cmd
|
||||
logfile.flush()
|
||||
return process.pid
|
||||
|
||||
def wait_for_disconnect(self, callback, *args, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -184,8 +184,8 @@ class Portal(object):
|
|||
application = service.Application('Portal')
|
||||
|
||||
# custom logging
|
||||
logfile = settings.SERVER_LOG_FILE if settings.MERGE_LOGS else settings.PORTAL_LOG_FILE
|
||||
logfile = logger.WeeklyLogFile(os.path.basename(logfile), os.path.dirname(logfile))
|
||||
logfile = logger.WeeklyLogFile(os.path.basename(settings.PORTAL_LOG_FILE),
|
||||
os.path.dirname(settings.PORTAL_LOG_FILE))
|
||||
application.setComponent(ILogObserver, logger.PortalLogObserver(logfile).emit)
|
||||
|
||||
# The main Portal server program. This sets up the database
|
||||
|
|
|
|||
|
|
@ -134,8 +134,6 @@ LOG_DIR = os.path.join(GAME_DIR, 'server', 'logs')
|
|||
SERVER_LOG_FILE = os.path.join(LOG_DIR, 'server.log')
|
||||
PORTAL_LOG_FILE = os.path.join(LOG_DIR, 'portal.log')
|
||||
HTTP_LOG_FILE = os.path.join(LOG_DIR, 'http_requests.log')
|
||||
# if this is true, merge logs into only the SERVER_LOG_FILE location.
|
||||
MERGE_LOGS = True
|
||||
# if this is set to the empty string, lockwarnings will be turned off.
|
||||
LOCKWARNING_LOG_FILE = os.path.join(LOG_DIR, 'lockwarnings.log')
|
||||
# Rotate log files when server and/or portal stops. This will keep log
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue