Configure logging permissions for Supervisord with Apache2 mod-WSGI + Tornado

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm running Tornado Python application behind apache2 mod-wsgi served by supervisord.
My supervisord config looks like
[supervisord]
nodaemon=true
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
user=root
group=root
[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
redirect_stderr=true
stdout_events_enabled=true
stderr_events_enabled=true
user=root
group=root
and my virtual host is
<VirtualHost *:$PORT>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory /tornado_api>
Order deny,allow
Allow from all
Require all granted
</Directory>
WSGIScriptAlias / /tornado/config.py
WSGIApplicationGroup %GLOBAL
</VirtualHost>
so I'm starting tornado from config.py like
PORT = os.getenv('PORT', 8888)
DIST = os.getenv('DIST', 'prod')
logger = configure_logger('default')
logger.info('Tornado starter on PORT %s ' % PORT)
http_server = HTTPServer( WSGIContainer(app) )
http_server.listen(int(PORT))
ioloop.IOLoop.instance().start()
where the logger takes a default configuration for logging like
def configure_logger(name='default'):
#"%Y%m%d-%H%M%S"
log_path = "/var/log/apache2/tornado_" + time.strftime("%Y%m%d") + ".log"
dictConfig(
'version': 1,
'formatters':
'default': 'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'
,
'handlers':
'console':
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stdout'
,
'file':
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
'filename': log_path,
'maxBytes': 1024,
'backupCount': 3
,
'loggers':
'default':
'level': 'DEBUG',
'handlers': ['console', 'file']
,
'disable_existing_loggers': False
)
return logging.getLogger(name)
The problem is that I cannot write to the specified logging folder under /var/log/apache2 even if I'm starting my service with mod-WSGI.
Any idea what is misconfigured?
apache-httpd python
add a comment |Â
up vote
0
down vote
favorite
I'm running Tornado Python application behind apache2 mod-wsgi served by supervisord.
My supervisord config looks like
[supervisord]
nodaemon=true
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
user=root
group=root
[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
redirect_stderr=true
stdout_events_enabled=true
stderr_events_enabled=true
user=root
group=root
and my virtual host is
<VirtualHost *:$PORT>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory /tornado_api>
Order deny,allow
Allow from all
Require all granted
</Directory>
WSGIScriptAlias / /tornado/config.py
WSGIApplicationGroup %GLOBAL
</VirtualHost>
so I'm starting tornado from config.py like
PORT = os.getenv('PORT', 8888)
DIST = os.getenv('DIST', 'prod')
logger = configure_logger('default')
logger.info('Tornado starter on PORT %s ' % PORT)
http_server = HTTPServer( WSGIContainer(app) )
http_server.listen(int(PORT))
ioloop.IOLoop.instance().start()
where the logger takes a default configuration for logging like
def configure_logger(name='default'):
#"%Y%m%d-%H%M%S"
log_path = "/var/log/apache2/tornado_" + time.strftime("%Y%m%d") + ".log"
dictConfig(
'version': 1,
'formatters':
'default': 'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'
,
'handlers':
'console':
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stdout'
,
'file':
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
'filename': log_path,
'maxBytes': 1024,
'backupCount': 3
,
'loggers':
'default':
'level': 'DEBUG',
'handlers': ['console', 'file']
,
'disable_existing_loggers': False
)
return logging.getLogger(name)
The problem is that I cannot write to the specified logging folder under /var/log/apache2 even if I'm starting my service with mod-WSGI.
Any idea what is misconfigured?
apache-httpd python
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm running Tornado Python application behind apache2 mod-wsgi served by supervisord.
My supervisord config looks like
[supervisord]
nodaemon=true
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
user=root
group=root
[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
redirect_stderr=true
stdout_events_enabled=true
stderr_events_enabled=true
user=root
group=root
and my virtual host is
<VirtualHost *:$PORT>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory /tornado_api>
Order deny,allow
Allow from all
Require all granted
</Directory>
WSGIScriptAlias / /tornado/config.py
WSGIApplicationGroup %GLOBAL
</VirtualHost>
so I'm starting tornado from config.py like
PORT = os.getenv('PORT', 8888)
DIST = os.getenv('DIST', 'prod')
logger = configure_logger('default')
logger.info('Tornado starter on PORT %s ' % PORT)
http_server = HTTPServer( WSGIContainer(app) )
http_server.listen(int(PORT))
ioloop.IOLoop.instance().start()
where the logger takes a default configuration for logging like
def configure_logger(name='default'):
#"%Y%m%d-%H%M%S"
log_path = "/var/log/apache2/tornado_" + time.strftime("%Y%m%d") + ".log"
dictConfig(
'version': 1,
'formatters':
'default': 'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'
,
'handlers':
'console':
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stdout'
,
'file':
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
'filename': log_path,
'maxBytes': 1024,
'backupCount': 3
,
'loggers':
'default':
'level': 'DEBUG',
'handlers': ['console', 'file']
,
'disable_existing_loggers': False
)
return logging.getLogger(name)
The problem is that I cannot write to the specified logging folder under /var/log/apache2 even if I'm starting my service with mod-WSGI.
Any idea what is misconfigured?
apache-httpd python
I'm running Tornado Python application behind apache2 mod-wsgi served by supervisord.
My supervisord config looks like
[supervisord]
nodaemon=true
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
user=root
group=root
[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
redirect_stderr=true
stdout_events_enabled=true
stderr_events_enabled=true
user=root
group=root
and my virtual host is
<VirtualHost *:$PORT>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory /tornado_api>
Order deny,allow
Allow from all
Require all granted
</Directory>
WSGIScriptAlias / /tornado/config.py
WSGIApplicationGroup %GLOBAL
</VirtualHost>
so I'm starting tornado from config.py like
PORT = os.getenv('PORT', 8888)
DIST = os.getenv('DIST', 'prod')
logger = configure_logger('default')
logger.info('Tornado starter on PORT %s ' % PORT)
http_server = HTTPServer( WSGIContainer(app) )
http_server.listen(int(PORT))
ioloop.IOLoop.instance().start()
where the logger takes a default configuration for logging like
def configure_logger(name='default'):
#"%Y%m%d-%H%M%S"
log_path = "/var/log/apache2/tornado_" + time.strftime("%Y%m%d") + ".log"
dictConfig(
'version': 1,
'formatters':
'default': 'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'
,
'handlers':
'console':
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stdout'
,
'file':
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
'filename': log_path,
'maxBytes': 1024,
'backupCount': 3
,
'loggers':
'default':
'level': 'DEBUG',
'handlers': ['console', 'file']
,
'disable_existing_loggers': False
)
return logging.getLogger(name)
The problem is that I cannot write to the specified logging folder under /var/log/apache2 even if I'm starting my service with mod-WSGI.
Any idea what is misconfigured?
apache-httpd python
apache-httpd python
asked 4 mins ago
loretoparisi
17812
17812
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474889%2fconfigure-logging-permissions-for-supervisord-with-apache2-mod-wsgi-tornado%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password